Skip to content

Commit

Permalink
Incorporate review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
leonardehrenfried committed Jan 22, 2024
1 parent cb59e3d commit de355dd
Show file tree
Hide file tree
Showing 14 changed files with 33 additions and 29 deletions.
14 changes: 8 additions & 6 deletions doc-templates/sandbox/MapboxVectorTilesApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,19 @@
## Contact Info

- HSL, Finland
- IBI Arcardis, US
- Arcadis, US

## Documentation

This API produces [Mapbox vector tiles](https://docs.mapbox.com/vector-tiles/reference/), which are
used by eg. [Digitransit-ui](https://github.com/HSLdevcom/digitransit-ui) to show information about
used by [Digitransit-ui](https://github.com/HSLdevcom/digitransit-ui) and
[`otp-react-redux`](https://github.com/opentripplanner/otp-react-redux) to show information about
public transit entities on the map.

The tiles can be fetched from `/otp/routers/{routerId}/vectorTiles/{layers}/{z}/{x}/{y}.pbf`,
where `layers` is a comma separated list of layer names from the configuration.

Maplibre/Mapbox GL JS also require a tilejson.json endpoint which is available at
Maplibre/Mapbox GL JS also requires a tilejson.json endpoint which is available at
`/otp/routers/{routerId}/vectorTiles/{layers}/tilejson.json`.

Translatable fields in the tiles are translated based on the `accept-language` header in requests.
Expand All @@ -37,7 +38,8 @@ The feature must be configured in `router-config.json` as follows

```JSON
{
"vectorTiles":
"vectorTiles": {
"basePath": "/only/configure/if/required",
"layers": [
{
"name": "stops",
Expand Down Expand Up @@ -145,8 +147,8 @@ For each layer, the configuration includes:

### Extending

If more generic layers are created for this API, it should be moved out from the sandbox, into the
core code, with potentially leaving specific property mappers in place.
If more generic layers are created for this API, the code should be moved out from the sandbox, into
the core, perhaps potentially leaving specific property mappers in place.

#### Creating a new layer

Expand Down
20 changes: 11 additions & 9 deletions docs/sandbox/MapboxVectorTilesApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,19 @@
## Contact Info

- HSL, Finland
- IBI Arcardis, US
- Arcadis, US

## Documentation

This API produces [Mapbox vector tiles](https://docs.mapbox.com/vector-tiles/reference/), which are
used by eg. [Digitransit-ui](https://github.com/HSLdevcom/digitransit-ui) to show information about
used by [Digitransit-ui](https://github.com/HSLdevcom/digitransit-ui) and
[`otp-react-redux`](https://github.com/opentripplanner/otp-react-redux) to show information about
public transit entities on the map.

The tiles can be fetched from `/otp/routers/{routerId}/vectorTiles/{layers}/{z}/{x}/{y}.pbf`,
where `layers` is a comma separated list of layer names from the configuration.

Maplibre/Mapbox GL JS also require a tilejson.json endpoint which is available at
Maplibre/Mapbox GL JS also requires a tilejson.json endpoint which is available at
`/otp/routers/{routerId}/vectorTiles/{layers}/tilejson.json`.

Translatable fields in the tiles are translated based on the `accept-language` header in requests.
Expand All @@ -37,7 +38,8 @@ The feature must be configured in `router-config.json` as follows

```JSON
{
"vectorTiles":
"vectorTiles": {
"basePath": "/only/configure/if/required",
"layers": [
{
"name": "stops",
Expand Down Expand Up @@ -168,9 +170,9 @@ The path of the vector tile source URLs in `tilejson.json`.

This is useful if you have a proxy setup and rewrite the path that is passed to OTP.

If you don't configure this optional value then the path returned in `tilejson.json` is
`/otp/routers/default/vectorTiles/layer1,layer2/{z}/{x}/{x}.pbf`. If you, for example, set
a value of `/otp_test/tiles` then the returned path changes to
If you don't configure this optional value then the path returned in `tilejson.json` is in
the format `/otp/routers/default/vectorTiles/layer1,layer2/{z}/{x}/{x}.pbf`.
If you, for example, set a value of `/otp_test/tiles` then the returned path changes to
`/otp_test/tiles/layer1,layer2/{z}/{x}/{x}.pbf`.

The protocol and host are always read from the incoming HTTP request. If you run OTP behind
Expand Down Expand Up @@ -219,8 +221,8 @@ Currently `Digitransit` is supported for all layer types.

### Extending

If more generic layers are created for this API, it should be moved out from the sandbox, into the
core code, with potentially leaving specific property mappers in place.
If more generic layers are created for this API, the code should be moved out from the sandbox, into
the core, perhaps potentially leaving specific property mappers in place.

#### Creating a new layer

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public class VectorTilesConfigDocTest {
public void updateDoc() {
NodeAdapter node = readVectorTiles();

// Read and close inout file (same as output file)
// Read and close input file (same as output file)
String template = readFile(TEMPLATE);
String original = readFile(OUT_FILE);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public class VehicleRentalServiceDirectoryConfigDocTest {
public void updateConfigurationDoc() {
NodeAdapter node = readConfigDefaults();

// Read and close inout file (same as output file)
// Read and close input file (same as output file)
String doc = readFile(TEMPLATE);
String original = readFile(OUT_FILE);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ public static VectorTileConfig mapVectorTilesParameters(NodeAdapter node, String
"""
This is useful if you have a proxy setup and rewrite the path that is passed to OTP.
If you don't configure this optional value then the path returned in `tilejson.json` is
`/otp/routers/default/vectorTiles/layer1,layer2/{z}/{x}/{x}.pbf`. If you, for example, set
a value of `/otp_test/tiles` then the returned path changes to
If you don't configure this optional value then the path returned in `tilejson.json` is in
the format `/otp/routers/default/vectorTiles/layer1,layer2/{z}/{x}/{x}.pbf`.
If you, for example, set a value of `/otp_test/tiles` then the returned path changes to
`/otp_test/tiles/layer1,layer2/{z}/{x}/{x}.pbf`.
The protocol and host are always read from the incoming HTTP request. If you run OTP behind
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public class BuildConfigurationDocTest {
public void updateBuildConfigurationDoc() {
NodeAdapter node = readBuildConfig();

// Read and close inout file (same as output file)
// Read and close input file (same as output file)
String doc = readFile(TEMPLATE);
String original = readFile(OUT_FILE);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public class ConfigurationDocTest {
*/
@Test
public void updateConfigurationDoc() {
// Read and close inout file (same as output file)
// Read and close input file (same as output file)
String doc = readFile(TEMPLATE);
String original = readFile(OUT_FILE);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public class FlexConfigurationDocTest {
public void updateFlexDoc() {
NodeAdapter node = readFlexConfig();

// Read and close inout file (same as output file)
// Read and close input file (same as output file)
String template = readFile(TEMPLATE);
String original = readFile(OUT_FILE);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public class GraphQLTutorialDocTest {
*/
@Test
public void updateTutorialDoc() throws IOException {
// Read and close inout file (same as output file)
// Read and close input file (same as output file)
String doc = readFile(TEMPLATE);
String original = readFile(OUT_FILE);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public class RouteRequestDocTest {
public void updateRouteRequestConfigurationDoc() {
NodeAdapter node = readRoutingDefaults();

// Read and close inout file (same as output file)
// Read and close input file (same as output file)
String doc = readFile(TEMPLATE);
String original = readFile(OUT_FILE);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public class RouterConfigurationDocTest {
public void updateBuildConfigurationDoc() {
NodeAdapter node = readRouterConfig();

// Read and close inout file (same as output file)
// Read and close input file (same as output file)
String doc = readFile(TEMPLATE);
String original = readFile(OUT_FILE);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class RoutingModeDocTest {

@Test
public void updateDocs() {
// Read and close inout file (same as output file)
// Read and close input file (same as output file)
String doc = readFile(TEMPLATE);
String original = readFile(OUT_FILE);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public class UpdaterConfigDocTest {
public void updateRouterConfigurationDoc() {
NodeAdapter node = readBuildConfig();

// Read and close inout file (same as output file)
// Read and close input file (same as output file)
String template = readFile(TEMPLATE);
String original = readFile(OUT_FILE);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public class VehicleParkingDocTest {
public void updateVehicleParkingDoc() {
NodeAdapter node = readVehicleUpdaters();

// Read and close inout file (same as output file)
// Read and close input file (same as output file)
String template = readFile(TEMPLATE);
String original = readFile(OUT_FILE);

Expand Down

0 comments on commit de355dd

Please sign in to comment.