diff --git a/application/src/main/java/org/opentripplanner/apis/vectortiles/DebugStyleSpec.java b/application/src/main/java/org/opentripplanner/apis/vectortiles/DebugStyleSpec.java index 1fc87176af8..beb8a087866 100644 --- a/application/src/main/java/org/opentripplanner/apis/vectortiles/DebugStyleSpec.java +++ b/application/src/main/java/org/opentripplanner/apis/vectortiles/DebugStyleSpec.java @@ -1,5 +1,7 @@ package org.opentripplanner.apis.vectortiles; +import static org.opentripplanner.inspector.vector.edge.EdgePropertyMapper.streetPermissionAsString; + import java.util.Arrays; import java.util.List; import java.util.stream.Collectors; @@ -13,6 +15,7 @@ import org.opentripplanner.apis.vectortiles.model.ZoomDependentNumber.ZoomStop; import org.opentripplanner.framework.collection.ListUtils; import org.opentripplanner.service.vehiclerental.street.StreetVehicleRentalLink; +import org.opentripplanner.service.vehiclerental.street.VehicleRentalPlaceVertex; import org.opentripplanner.street.model.StreetTraversalPermission; import org.opentripplanner.street.model.edge.AreaEdge; import org.opentripplanner.street.model.edge.BoardingLocationToStopLink; @@ -30,8 +33,8 @@ import org.opentripplanner.street.model.vertex.VehicleParkingEntranceVertex; /** - * A Mapbox/Mapblibre style specification for rendering debug information about transit and - * street data. + * A Mapbox/Mapblibre style specification for rendering debug information about transit and street + * data. */ public class DebugStyleSpec { @@ -47,13 +50,18 @@ public class DebugStyleSpec { private static final String DARK_GREEN = "#136b04"; private static final String PURPLE = "#BC55F2"; private static final String BLACK = "#140d0e"; + private static final String GRAY = "#DDDDDD"; private static final int MAX_ZOOM = 23; + private static final int LINE_DETAIL_ZOOM = 13; private static final ZoomDependentNumber LINE_OFFSET = new ZoomDependentNumber( - List.of(new ZoomStop(13, 0.3f), new ZoomStop(MAX_ZOOM, 6)) + List.of(new ZoomStop(LINE_DETAIL_ZOOM, 0.4f), new ZoomStop(MAX_ZOOM, 7)) ); private static final ZoomDependentNumber LINE_WIDTH = new ZoomDependentNumber( - List.of(new ZoomStop(13, 0.2f), new ZoomStop(MAX_ZOOM, 8)) + List.of(new ZoomStop(LINE_DETAIL_ZOOM, 0.2f), new ZoomStop(MAX_ZOOM, 8)) + ); + private static final ZoomDependentNumber LINE_HALF_WIDTH = new ZoomDependentNumber( + List.of(new ZoomStop(LINE_DETAIL_ZOOM, 0.1f), new ZoomStop(MAX_ZOOM, 6)) ); private static final ZoomDependentNumber CIRCLE_STROKE = new ZoomDependentNumber( List.of(new ZoomStop(15, 0.2f), new ZoomStop(MAX_ZOOM, 3)) @@ -70,7 +78,14 @@ public class DebugStyleSpec { private static final String EDGES_GROUP = "Edges"; private static final String STOPS_GROUP = "Stops"; private static final String VERTICES_GROUP = "Vertices"; - private static final String TRAVERSAL_PERMISSIONS_GROUP = "Traversal permissions"; + private static final String PERMISSIONS_GROUP = "Permissions"; + private static final String NO_THRU_TRAFFIC_GROUP = "No-thru traffic"; + + private static final StreetTraversalPermission[] streetModes = new StreetTraversalPermission[] { + StreetTraversalPermission.PEDESTRIAN, + StreetTraversalPermission.BICYCLE, + StreetTraversalPermission.CAR, + }; static StyleSpec build( VectorSourceLayer regularStops, @@ -90,8 +105,9 @@ static StyleSpec build( allSources, ListUtils.combine( List.of(StyleBuilder.ofId("background").typeRaster().source(BACKGROUND_SOURCE).minZoom(0)), - traversalPermissions(edges), edges(edges), + traversalPermissions(edges), + noThruTraffic(edges), vertices(vertices), stops(regularStops, areaStops, groupStops) ) @@ -181,9 +197,8 @@ private static List edges(VectorSourceLayer edges) { .group(EDGES_GROUP) .typeLine() .vectorSourceLayer(edges) - .lineColor(MAGENTA) - .edgeFilter(EDGES_TO_DISPLAY) - .lineWidth(LINE_WIDTH) + .lineColor(GRAY) + .lineWidth(LINE_HALF_WIDTH) .lineOffset(LINE_OFFSET) .minZoom(6) .maxZoom(MAX_ZOOM) @@ -194,7 +209,6 @@ private static List edges(VectorSourceLayer edges) { .typeSymbol() .lineText("name") .vectorSourceLayer(edges) - .edgeFilter(EDGES_TO_DISPLAY) .minZoom(17) .maxZoom(MAX_ZOOM) .intiallyHidden(), @@ -203,7 +217,8 @@ private static List edges(VectorSourceLayer edges) { .group(EDGES_GROUP) .typeLine() .vectorSourceLayer(edges) - .lineColor(BRIGHT_GREEN) + .lineColor(GRAY) + .lineOpacity(0.2f) .edgeFilter( StreetTransitStopLink.class, StreetTransitEntranceLink.class, @@ -222,26 +237,28 @@ private static List edges(VectorSourceLayer edges) { private static List traversalPermissions(VectorSourceLayer edges) { var permissionStyles = Arrays - .stream(StreetTraversalPermission.values()) - .map(p -> + .stream(streetModes) + .map(streetTraversalPermission -> StyleBuilder - .ofId(p.name()) + .ofId("permission " + streetTraversalPermission) .vectorSourceLayer(edges) - .group(TRAVERSAL_PERMISSIONS_GROUP) + .group(PERMISSIONS_GROUP) .typeLine() - .lineColor(permissionColor(p)) - .permissionsFilter(p) + .filterValueInProperty(streetTraversalPermission.name(), "permission") + .lineCap("butt") + .lineColorMatch("permission", permissionColors(), BLACK) .lineWidth(LINE_WIDTH) .lineOffset(LINE_OFFSET) - .minZoom(6) + .minZoom(LINE_DETAIL_ZOOM) .maxZoom(MAX_ZOOM) .intiallyHidden() ) .toList(); + var textStyle = StyleBuilder .ofId("permission-text") .vectorSourceLayer(edges) - .group(TRAVERSAL_PERMISSIONS_GROUP) + .group(PERMISSIONS_GROUP) .typeSymbol() .lineText("permission") .textOffset(1) @@ -249,12 +266,55 @@ private static List traversalPermissions(VectorSourceLayer edges) .minZoom(17) .maxZoom(MAX_ZOOM) .intiallyHidden(); + return ListUtils.combine(permissionStyles, List.of(textStyle)); } - private static String permissionColor(StreetTraversalPermission p) { + private static List noThruTraffic(VectorSourceLayer edges) { + var noThruTrafficStyles = Arrays + .stream(streetModes) + .map(streetTraversalPermission -> + StyleBuilder + .ofId("no-thru-traffic " + streetTraversalPermission) + .vectorSourceLayer(edges) + .group(NO_THRU_TRAFFIC_GROUP) + .typeLine() + .filterValueInProperty(streetTraversalPermission.name(), "noThruTraffic") + .lineCap("butt") + .lineColorMatch("noThruTraffic", permissionColors(), BLACK) + .lineWidth(LINE_WIDTH) + .lineOffset(LINE_OFFSET) + .minZoom(LINE_DETAIL_ZOOM) + .maxZoom(MAX_ZOOM) + .intiallyHidden() + ) + .toList(); + + var textStyle = StyleBuilder + .ofId("no-thru-traffic-text") + .vectorSourceLayer(edges) + .group(NO_THRU_TRAFFIC_GROUP) + .typeSymbol() + .lineText("noThruTraffic") + .textOffset(1) + .edgeFilter(EDGES_TO_DISPLAY) + .minZoom(17) + .maxZoom(MAX_ZOOM) + .intiallyHidden(); + + return ListUtils.combine(noThruTrafficStyles, List.of(textStyle)); + } + + private static List permissionColors() { + return Arrays + .stream(StreetTraversalPermission.values()) + .flatMap(p -> Stream.of(streetPermissionAsString(p), permissionColors(p))) + .toList(); + } + + private static String permissionColors(StreetTraversalPermission p) { return switch (p) { - case NONE -> "#000"; + case NONE -> BLACK; case PEDESTRIAN -> "#2ba812"; case BICYCLE, PEDESTRIAN_AND_BICYCLE -> "#10d3b6"; case CAR -> "#f92e13"; diff --git a/application/src/main/java/org/opentripplanner/apis/vectortiles/model/StyleBuilder.java b/application/src/main/java/org/opentripplanner/apis/vectortiles/model/StyleBuilder.java index 93b7ea91e7c..316fa56d4eb 100644 --- a/application/src/main/java/org/opentripplanner/apis/vectortiles/model/StyleBuilder.java +++ b/application/src/main/java/org/opentripplanner/apis/vectortiles/model/StyleBuilder.java @@ -3,6 +3,7 @@ import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import java.util.Arrays; +import java.util.Collection; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; @@ -29,7 +30,7 @@ public class StyleBuilder { private final Map layout = new LinkedHashMap<>(); private final Map metadata = new LinkedHashMap<>(); private final Map line = new LinkedHashMap<>(); - private List filter = List.of(); + private List filter = List.of(); public static StyleBuilder ofId(String id) { return new StyleBuilder(id); @@ -167,12 +168,42 @@ public StyleBuilder circleRadius(ZoomDependentNumber radius) { } // Line styling + public StyleBuilder lineCap(String lineCap) { + layout.put("line-cap", lineCap); + return this; + } public StyleBuilder lineColor(String color) { paint.put("line-color", validateColor(color)); return this; } + public StyleBuilder lineColorMatch( + String propertyName, + Collection values, + String defaultValue + ) { + paint.put( + "line-color", + ListUtils.combine( + List.of("match", List.of("get", propertyName)), + (Collection) values, + List.of(defaultValue) + ) + ); + return this; + } + + public StyleBuilder lineOpacity(float lineOpacity) { + paint.put("line-opacity", lineOpacity); + return this; + } + + public StyleBuilder lineDasharray(float... dashArray) { + paint.put("line-dasharray", dashArray); + return this; + } + public StyleBuilder lineWidth(float width) { paint.put("line-width", width); return this; @@ -235,6 +266,11 @@ public final StyleBuilder vertexFilter(Class... classToFilter) return filterClasses(classToFilter); } + public StyleBuilder filterValueInProperty(String value, String propertyName) { + filter = List.of("in", value, List.of("string", List.of("get", propertyName))); + return this; + } + public JsonNode toJson() { validate(); diff --git a/application/src/main/java/org/opentripplanner/inspector/vector/edge/EdgePropertyMapper.java b/application/src/main/java/org/opentripplanner/inspector/vector/edge/EdgePropertyMapper.java index d43a91d384d..ae7e4969428 100644 --- a/application/src/main/java/org/opentripplanner/inspector/vector/edge/EdgePropertyMapper.java +++ b/application/src/main/java/org/opentripplanner/inspector/vector/edge/EdgePropertyMapper.java @@ -9,6 +9,7 @@ import org.opentripplanner.apis.support.mapping.PropertyMapper; import org.opentripplanner.framework.collection.ListUtils; import org.opentripplanner.inspector.vector.KeyValue; +import org.opentripplanner.street.model.StreetTraversalPermission; import org.opentripplanner.street.model.edge.Edge; import org.opentripplanner.street.model.edge.EscalatorEdge; import org.opentripplanner.street.model.edge.StreetEdge; @@ -29,8 +30,9 @@ protected Collection map(Edge input) { private static List mapStreetEdge(StreetEdge se) { var props = Lists.newArrayList( - kv("permission", se.getPermission().toString()), - kv("bicycleSafetyFactor", roundTo2Decimals(se.getBicycleSafetyFactor())) + kv("permission", streetPermissionAsString(se.getPermission())), + kv("bicycleSafetyFactor", roundTo2Decimals(se.getBicycleSafetyFactor())), + kv("noThruTraffic", noThruTrafficAsString(se)) ); if (se.hasBogusName()) { props.addFirst(kv("name", "%s (generated)".formatted(se.getName().toString()))); @@ -39,4 +41,26 @@ private static List mapStreetEdge(StreetEdge se) { } return props; } + + public static String streetPermissionAsString(StreetTraversalPermission permission) { + return ( + permission == StreetTraversalPermission.ALL + ? "PEDESTRIAN_AND_BICYCLE_AND_CAR" + : permission.toString() + ).replace("_AND_", " "); + } + + private static String noThruTrafficAsString(StreetEdge se) { + var noThruPermission = StreetTraversalPermission.NONE; + if (se.isWalkNoThruTraffic()) { + noThruPermission = noThruPermission.add(StreetTraversalPermission.PEDESTRIAN); + } + if (se.isBicycleNoThruTraffic()) { + noThruPermission = noThruPermission.add(StreetTraversalPermission.BICYCLE); + } + if (se.isMotorVehicleNoThruTraffic()) { + noThruPermission = noThruPermission.add(StreetTraversalPermission.CAR); + } + return streetPermissionAsString(noThruPermission); + } } diff --git a/application/src/test/resources/org/opentripplanner/apis/vectortiles/style.json b/application/src/test/resources/org/opentripplanner/apis/vectortiles/style.json index 8a0e457396e..1aad369a557 100644 --- a/application/src/test/resources/org/opentripplanner/apis/vectortiles/style.json +++ b/application/src/test/resources/org/opentripplanner/apis/vectortiles/style.json @@ -28,14 +28,14 @@ } }, { - "id" : "NONE", + "id" : "edge", + "type" : "line", "source" : "vectorSource", "source-layer" : "edges", - "type" : "line", "minzoom" : 6, "maxzoom" : 23, "paint" : { - "line-color" : "#000", + "line-color" : "#DDDDDD", "line-width" : [ "interpolate", [ @@ -45,9 +45,9 @@ "zoom" ], 13, - 0.2, + 0.1, 23, - 8.0 + 6.0 ], "line-offset" : [ "interpolate", @@ -58,33 +58,72 @@ "zoom" ], 13, - 0.3, + 0.4, 23, - 6.0 + 7.0 ] }, - "filter" : [ - "==", - "permission", - "NONE" - ], "layout" : { "line-cap" : "round", "visibility" : "none" }, "metadata" : { - "group" : "Traversal permissions" + "group" : "Edges" } }, { - "id" : "PEDESTRIAN", + "id" : "edge-name", + "type" : "symbol", "source" : "vectorSource", "source-layer" : "edges", + "minzoom" : 17, + "maxzoom" : 23, + "paint" : { + "text-color" : "#000", + "text-halo-color" : "#fff", + "text-halo-blur" : 4, + "text-halo-width" : 3 + }, + "layout" : { + "symbol-placement" : "line-center", + "symbol-spacing" : 1000, + "text-field" : "{name}", + "text-font" : [ + "KlokanTech Noto Sans Regular" + ], + "text-size" : [ + "interpolate", + [ + "linear" + ], + [ + "zoom" + ], + 10, + 6.0, + 24, + 12.0 + ], + "text-max-width" : 100, + "text-keep-upright" : true, + "text-rotation-alignment" : "map", + "text-overlap" : "never", + "visibility" : "none" + }, + "metadata" : { + "group" : "Edges" + } + }, + { + "id" : "link", "type" : "line", - "minzoom" : 6, + "source" : "vectorSource", + "source-layer" : "edges", + "minzoom" : 13, "maxzoom" : 23, "paint" : { - "line-color" : "#2ba812", + "line-color" : "#DDDDDD", + "line-opacity" : 0.2, "line-width" : [ "interpolate", [ @@ -107,33 +146,61 @@ "zoom" ], 13, - 0.3, + 0.4, 23, - 6.0 + 7.0 ] }, "filter" : [ - "==", - "permission", - "PEDESTRIAN" + "in", + "class", + "StreetTransitStopLink", + "StreetTransitEntranceLink", + "BoardingLocationToStopLink", + "StreetVehicleRentalLink", + "StreetVehicleParkingLink", + "StreetStationCentroidLink" ], "layout" : { "line-cap" : "round", "visibility" : "none" }, "metadata" : { - "group" : "Traversal permissions" + "group" : "Edges" } }, { - "id" : "BICYCLE", + "id" : "permission PEDESTRIAN", "source" : "vectorSource", "source-layer" : "edges", "type" : "line", - "minzoom" : 6, + "minzoom" : 13, "maxzoom" : 23, "paint" : { - "line-color" : "#10d3b6", + "line-color" : [ + "match", + [ + "get", + "permission" + ], + "NONE", + "#140d0e", + "PEDESTRIAN", + "#2ba812", + "BICYCLE", + "#10d3b6", + "PEDESTRIAN BICYCLE", + "#10d3b6", + "CAR", + "#f92e13", + "PEDESTRIAN CAR", + "#e25f8f", + "BICYCLE CAR", + "#e25f8f", + "PEDESTRIAN BICYCLE CAR", + "#adb2b0", + "#140d0e" + ], "line-width" : [ "interpolate", [ @@ -156,33 +223,62 @@ "zoom" ], 13, - 0.3, + 0.4, 23, - 6.0 + 7.0 ] }, "filter" : [ - "==", - "permission", - "BICYCLE" + "in", + "PEDESTRIAN", + [ + "string", + [ + "get", + "permission" + ] + ] ], "layout" : { - "line-cap" : "round", + "line-cap" : "butt", "visibility" : "none" }, "metadata" : { - "group" : "Traversal permissions" + "group" : "Permissions" } }, { - "id" : "PEDESTRIAN_AND_BICYCLE", + "id" : "permission BICYCLE", "source" : "vectorSource", "source-layer" : "edges", "type" : "line", - "minzoom" : 6, + "minzoom" : 13, "maxzoom" : 23, "paint" : { - "line-color" : "#10d3b6", + "line-color" : [ + "match", + [ + "get", + "permission" + ], + "NONE", + "#140d0e", + "PEDESTRIAN", + "#2ba812", + "BICYCLE", + "#10d3b6", + "PEDESTRIAN BICYCLE", + "#10d3b6", + "CAR", + "#f92e13", + "PEDESTRIAN CAR", + "#e25f8f", + "BICYCLE CAR", + "#e25f8f", + "PEDESTRIAN BICYCLE CAR", + "#adb2b0", + "#140d0e" + ], "line-width" : [ "interpolate", [ @@ -205,33 +301,62 @@ "zoom" ], 13, - 0.3, + 0.4, 23, - 6.0 + 7.0 ] }, "filter" : [ - "==", - "permission", - "PEDESTRIAN_AND_BICYCLE" + "in", + "BICYCLE", + [ + "string", + [ + "get", + "permission" + ] + ] ], "layout" : { - "line-cap" : "round", + "line-cap" : "butt", "visibility" : "none" }, "metadata" : { - "group" : "Traversal permissions" + "group" : "Permissions" } }, { - "id" : "CAR", + "id" : "permission CAR", "source" : "vectorSource", "source-layer" : "edges", "type" : "line", - "minzoom" : 6, + "minzoom" : 13, "maxzoom" : 23, "paint" : { - "line-color" : "#f92e13", + "line-color" : [ + "match", + [ + "get", + "permission" + ], + "NONE", + "#140d0e", + "PEDESTRIAN", + "#2ba812", + "BICYCLE", + "#10d3b6", + "PEDESTRIAN BICYCLE", + "#10d3b6", + "CAR", + "#f92e13", + "PEDESTRIAN CAR", + "#e25f8f", + "BICYCLE CAR", + "#e25f8f", + "PEDESTRIAN BICYCLE CAR", + "#adb2b0", + "#140d0e" + ], "line-width" : [ "interpolate", [ @@ -254,47 +379,62 @@ "zoom" ], 13, - 0.3, + 0.4, 23, - 6.0 + 7.0 ] }, "filter" : [ - "==", - "permission", - "CAR" + "in", + "CAR", + [ + "string", + [ + "get", + "permission" + ] + ] ], "layout" : { - "line-cap" : "round", + "line-cap" : "butt", "visibility" : "none" }, "metadata" : { - "group" : "Traversal permissions" + "group" : "Permissions" } }, { - "id" : "PEDESTRIAN_AND_CAR", + "id" : "permission-text", "source" : "vectorSource", "source-layer" : "edges", - "type" : "line", - "minzoom" : 6, + "type" : "symbol", + "minzoom" : 17, "maxzoom" : 23, "paint" : { - "line-color" : "#e25f8f", - "line-width" : [ - "interpolate", - [ - "linear" - ], - [ - "zoom" - ], - 13, - 0.2, - 23, - 8.0 + "text-color" : "#000", + "text-halo-color" : "#fff", + "text-halo-blur" : 4, + "text-halo-width" : 3 + }, + "filter" : [ + "in", + "class", + "StreetEdge", + "AreaEdge", + "EscalatorEdge", + "PathwayEdge", + "ElevatorHopEdge", + "TemporaryPartialStreetEdge", + "TemporaryFreeEdge" + ], + "layout" : { + "symbol-placement" : "line-center", + "symbol-spacing" : 1000, + "text-field" : "{permission}", + "text-font" : [ + "KlokanTech Noto Sans Regular" ], - "line-offset" : [ + "text-size" : [ "interpolate", [ "linear" @@ -302,34 +442,57 @@ [ "zoom" ], - 13, - 0.3, - 23, - 6.0 - ] - }, - "filter" : [ - "==", - "permission", - "PEDESTRIAN_AND_CAR" - ], - "layout" : { - "line-cap" : "round", + 10, + 6.0, + 24, + 12.0 + ], + "text-max-width" : 100, + "text-keep-upright" : true, + "text-rotation-alignment" : "map", + "text-overlap" : "never", + "text-offset" : [ + 0, + 1.0 + ], "visibility" : "none" }, "metadata" : { - "group" : "Traversal permissions" + "group" : "Permissions" } }, { - "id" : "BICYCLE_AND_CAR", + "id" : "no-thru-traffic PEDESTRIAN", "source" : "vectorSource", "source-layer" : "edges", "type" : "line", - "minzoom" : 6, + "minzoom" : 13, "maxzoom" : 23, "paint" : { - "line-color" : "#e25f8f", + "line-color" : [ + "match", + [ + "get", + "noThruTraffic" + ], + "NONE", + "#140d0e", + "PEDESTRIAN", + "#2ba812", + "BICYCLE", + "#10d3b6", + "PEDESTRIAN BICYCLE", + "#10d3b6", + "CAR", + "#f92e13", + "PEDESTRIAN CAR", + "#e25f8f", + "BICYCLE CAR", + "#e25f8f", + "PEDESTRIAN BICYCLE CAR", + "#adb2b0", + "#140d0e" + ], "line-width" : [ "interpolate", [ @@ -352,33 +515,62 @@ "zoom" ], 13, - 0.3, + 0.4, 23, - 6.0 + 7.0 ] }, "filter" : [ - "==", - "permission", - "BICYCLE_AND_CAR" + "in", + "PEDESTRIAN", + [ + "string", + [ + "get", + "noThruTraffic" + ] + ] ], "layout" : { - "line-cap" : "round", + "line-cap" : "butt", "visibility" : "none" }, "metadata" : { - "group" : "Traversal permissions" + "group" : "No-thru traffic" } }, { - "id" : "ALL", + "id" : "no-thru-traffic BICYCLE", "source" : "vectorSource", "source-layer" : "edges", "type" : "line", - "minzoom" : 6, + "minzoom" : 13, "maxzoom" : 23, "paint" : { - "line-color" : "#adb2b0", + "line-color" : [ + "match", + [ + "get", + "noThruTraffic" + ], + "NONE", + "#140d0e", + "PEDESTRIAN", + "#2ba812", + "BICYCLE", + "#10d3b6", + "PEDESTRIAN BICYCLE", + "#10d3b6", + "CAR", + "#f92e13", + "PEDESTRIAN CAR", + "#e25f8f", + "BICYCLE CAR", + "#e25f8f", + "PEDESTRIAN BICYCLE CAR", + "#adb2b0", + "#140d0e" + ], "line-width" : [ "interpolate", [ @@ -401,91 +593,62 @@ "zoom" ], 13, - 0.3, + 0.4, 23, - 6.0 + 7.0 ] }, - "filter" : [ - "==", - "permission", - "ALL" - ], - "layout" : { - "line-cap" : "round", - "visibility" : "none" - }, - "metadata" : { - "group" : "Traversal permissions" - } - }, - { - "id" : "permission-text", - "source" : "vectorSource", - "source-layer" : "edges", - "type" : "symbol", - "minzoom" : 17, - "maxzoom" : 23, - "paint" : { - "text-color" : "#000", - "text-halo-color" : "#fff", - "text-halo-blur" : 4, - "text-halo-width" : 3 - }, "filter" : [ "in", - "class", - "StreetEdge", - "AreaEdge", - "EscalatorEdge", - "PathwayEdge", - "ElevatorHopEdge", - "TemporaryPartialStreetEdge", - "TemporaryFreeEdge" + "BICYCLE", + [ + "string", + [ + "get", + "noThruTraffic" + ] + ] ], "layout" : { - "symbol-placement" : "line-center", - "symbol-spacing" : 1000, - "text-field" : "{permission}", - "text-font" : [ - "KlokanTech Noto Sans Regular" - ], - "text-size" : [ - "interpolate", - [ - "linear" - ], - [ - "zoom" - ], - 10, - 6.0, - 24, - 12.0 - ], - "text-max-width" : 100, - "text-keep-upright" : true, - "text-rotation-alignment" : "map", - "text-overlap" : "never", - "text-offset" : [ - 0, - 1.0 - ], + "line-cap" : "butt", "visibility" : "none" }, "metadata" : { - "group" : "Traversal permissions" + "group" : "No-thru traffic" } }, { - "id" : "edge", - "type" : "line", + "id" : "no-thru-traffic CAR", "source" : "vectorSource", "source-layer" : "edges", - "minzoom" : 6, + "type" : "line", + "minzoom" : 13, "maxzoom" : 23, "paint" : { - "line-color" : "#f21d52", + "line-color" : [ + "match", + [ + "get", + "noThruTraffic" + ], + "NONE", + "#140d0e", + "PEDESTRIAN", + "#2ba812", + "BICYCLE", + "#10d3b6", + "PEDESTRIAN BICYCLE", + "#10d3b6", + "CAR", + "#f92e13", + "PEDESTRIAN CAR", + "#e25f8f", + "BICYCLE CAR", + "#e25f8f", + "PEDESTRIAN BICYCLE CAR", + "#adb2b0", + "#140d0e" + ], "line-width" : [ "interpolate", [ @@ -508,35 +671,35 @@ "zoom" ], 13, - 0.3, + 0.4, 23, - 6.0 + 7.0 ] }, "filter" : [ "in", - "class", - "StreetEdge", - "AreaEdge", - "EscalatorEdge", - "PathwayEdge", - "ElevatorHopEdge", - "TemporaryPartialStreetEdge", - "TemporaryFreeEdge" + "CAR", + [ + "string", + [ + "get", + "noThruTraffic" + ] + ] ], "layout" : { - "line-cap" : "round", + "line-cap" : "butt", "visibility" : "none" }, "metadata" : { - "group" : "Edges" + "group" : "No-thru traffic" } }, { - "id" : "edge-name", - "type" : "symbol", + "id" : "no-thru-traffic-text", "source" : "vectorSource", "source-layer" : "edges", + "type" : "symbol", "minzoom" : 17, "maxzoom" : 23, "paint" : { @@ -559,7 +722,7 @@ "layout" : { "symbol-placement" : "line-center", "symbol-spacing" : 1000, - "text-field" : "{name}", + "text-field" : "{noThruTraffic}", "text-font" : [ "KlokanTech Noto Sans Regular" ], @@ -580,64 +743,14 @@ "text-keep-upright" : true, "text-rotation-alignment" : "map", "text-overlap" : "never", - "visibility" : "none" - }, - "metadata" : { - "group" : "Edges" - } - }, - { - "id" : "link", - "type" : "line", - "source" : "vectorSource", - "source-layer" : "edges", - "minzoom" : 13, - "maxzoom" : 23, - "paint" : { - "line-color" : "#22DD9E", - "line-width" : [ - "interpolate", - [ - "linear" - ], - [ - "zoom" - ], - 13, - 0.2, - 23, - 8.0 + "text-offset" : [ + 0, + 1.0 ], - "line-offset" : [ - "interpolate", - [ - "linear" - ], - [ - "zoom" - ], - 13, - 0.3, - 23, - 6.0 - ] - }, - "filter" : [ - "in", - "class", - "StreetTransitStopLink", - "StreetTransitEntranceLink", - "BoardingLocationToStopLink", - "StreetVehicleRentalLink", - "StreetVehicleParkingLink", - "StreetStationCentroidLink" - ], - "layout" : { - "line-cap" : "round", "visibility" : "none" }, "metadata" : { - "group" : "Edges" + "group" : "No-thru traffic" } }, {