Skip to content

Commit

Permalink
Merge pull request #4404 from HSLdevcom/vector-layer-updates
Browse files Browse the repository at this point in the history
Digitransit stop vector layer updates
  • Loading branch information
optionsome authored Aug 24, 2022
2 parents 296a0dd + 2405594 commit 0722e64
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
1 change: 1 addition & 0 deletions docs/sandbox/MapboxVectorTilesApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
name [#3648](https://github.com/opentripplanner/OpenTripPlanner/pull/3648)
- 2022-01-03: Add support for VehicleParking entities
- 2022-04-27: Read the headsign for frequency-only patterns correctly [#4122](https://github.com/opentripplanner/OpenTripPlanner/pull/4122)
- 2022-08-23: Remove patterns and add route gtfsTypes to stop layer [#4404](https://github.com/opentripplanner/OpenTripPlanner/pull/4404)

## Documentation

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,16 @@ public Collection<T2<String, Object>> map(RegularStop stop) {
.map(Enum::name)
.orElse(null);

String patterns = JSONArray.toJSONString(
patternsForStop
String routes = JSONArray.toJSONString(
transitService
.getRoutesForStop(stop)
.stream()
.map(tripPattern -> {
String headsign = tripPattern.getStopHeadsign(tripPattern.findStopPosition(stop));
JSONObject pattern = new JSONObject();
pattern.put("headsign", Optional.ofNullable(headsign).orElse(""));
pattern.put("type", tripPattern.getRoute().getMode().name());
pattern.put("shortName", tripPattern.getRoute().getShortName());
return pattern;
.map(route -> {
JSONObject routeObject = new JSONObject();
routeObject.put("gtfsType", route.getGtfsType());
return routeObject;
})
.collect(Collectors.toList())
.toList()
);
String desc = stop.getDescription() != null ? stop.getDescription().toString() : null;
return List.of(
Expand All @@ -67,7 +65,7 @@ public Collection<T2<String, Object>> map(RegularStop stop) {
stop.getParentStation() != null ? stop.getParentStation().getId() : "null"
),
new T2<>("type", type),
new T2<>("patterns", patterns)
new T2<>("routes", routes)
);
}
}

0 comments on commit 0722e64

Please sign in to comment.