Skip to content

Commit

Permalink
config doc fix, parentstation not shared
Browse files Browse the repository at this point in the history
  • Loading branch information
sharhio committed Mar 21, 2024
1 parent d75df7f commit 5132bf2
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 7 deletions.
2 changes: 1 addition & 1 deletion doc-templates/sandbox/MapboxVectorTilesApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ The feature must be configured in `router-config.json` as follows
"mapper": "DigitransitRealtime",
"maxZoom": 20,
"minZoom": 14,
"cacheMaxSeconds": 600
"cacheMaxSeconds": 60
},
// This exists for backwards compatibility. At some point, we might want
// to add a new real-time parking mapper with better translation support
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,13 @@ protected Collection<KeyValue> map(RegularStop stop) {
Collection<KeyValue> sharedKeyValues = getBaseKeyValues(stop, i18NStringMapper, transitService);
return ListUtils.combine(
sharedKeyValues,
List.of(new KeyValue("closedByServiceAlert", noServiceAlert))
List.of(
new KeyValue("closedByServiceAlert", noServiceAlert),
new KeyValue(
"parentStation",
stop.getParentStation() != null ? stop.getParentStation().getId() : null
)
)
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import org.opentripplanner.apis.support.mapping.PropertyMapper;
import org.opentripplanner.framework.collection.ListUtils;
import org.opentripplanner.framework.i18n.I18NStringMapper;
import org.opentripplanner.inspector.vector.KeyValue;
import org.opentripplanner.transit.model.network.TripPattern;
Expand All @@ -34,7 +35,16 @@ protected static DigitransitStopPropertyMapper create(

@Override
protected Collection<KeyValue> map(RegularStop stop) {
return getBaseKeyValues(stop, i18NStringMapper, transitService);
Collection<KeyValue> sharedKeyValues = getBaseKeyValues(stop, i18NStringMapper, transitService);
return ListUtils.combine(
sharedKeyValues,
List.of(
new KeyValue(
"parentStation",
stop.getParentStation() != null ? stop.getParentStation().getId() : "null"
)
)
);
}

protected static Collection<KeyValue> getBaseKeyValues(
Expand All @@ -48,10 +58,6 @@ protected static Collection<KeyValue> getBaseKeyValues(
new KeyValue("code", stop.getCode()),
new KeyValue("platform", stop.getPlatformCode()),
new KeyValue("desc", i18NStringMapper.mapToApi(stop.getDescription())),
new KeyValue(
"parentStation",
stop.getParentStation() != null ? stop.getParentStation().getId() : null
),
new KeyValue("type", getType(transitService, stop)),
new KeyValue("routes", getRoutes(transitService, stop))
);
Expand Down

0 comments on commit 5132bf2

Please sign in to comment.