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 b061a00df50..f27d252f250 100644 --- a/application/src/main/java/org/opentripplanner/apis/vectortiles/DebugStyleSpec.java +++ b/application/src/main/java/org/opentripplanner/apis/vectortiles/DebugStyleSpec.java @@ -106,9 +106,9 @@ static StyleSpec build( ListUtils.combine( List.of(StyleBuilder.ofId("background").typeRaster().source(BACKGROUND_SOURCE).minZoom(0)), wheelchair(edges), - edges(edges), - traversalPermissions(edges), noThruTraffic(edges), + traversalPermissions(edges), + edges(edges), vertices(vertices), stops(regularStops, areaStops, groupStops) ) diff --git a/application/src/main/java/org/opentripplanner/osm/tagmapping/ConstantSpeedMapper.java b/application/src/main/java/org/opentripplanner/osm/tagmapping/ConstantSpeedMapper.java index e2ecb998159..987cc8b8355 100644 --- a/application/src/main/java/org/opentripplanner/osm/tagmapping/ConstantSpeedMapper.java +++ b/application/src/main/java/org/opentripplanner/osm/tagmapping/ConstantSpeedMapper.java @@ -1,5 +1,6 @@ package org.opentripplanner.osm.tagmapping; +import java.util.Set; import org.opentripplanner.osm.model.OsmWithTags; import org.opentripplanner.osm.wayproperty.WayPropertySet; @@ -8,6 +9,14 @@ */ class ConstantSpeedFinlandMapper extends FinlandMapper { + private static final Set NOTHROUGH_DRIVING_TAGS = Set.of( + "parking_aisle", + "driveway", + "alley", + "emergency_access", + "drive-through" + ); + private float speed; public ConstantSpeedFinlandMapper() { @@ -42,4 +51,16 @@ public Float getMaxUsedCarSpeed(WayPropertySet wayPropertySet) { // than what is used for the street edge car speeds. return speed; } + + @Override + public boolean isMotorVehicleThroughTrafficExplicitlyDisallowed(OsmWithTags way) { + if (super.isMotorVehicleThroughTrafficExplicitlyDisallowed(way)) { + return true; + } + /* + * Constant speed routing tends to use unrecommended shortcuts + * through parking areas etc. Prevent this. + */ + return way.isOneOfTags("service", NOTHROUGH_DRIVING_TAGS); + } } 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 27d708e1b1d..2cf936a1e63 100644 --- a/application/src/test/resources/org/opentripplanner/apis/vectortiles/style.json +++ b/application/src/test/resources/org/opentripplanner/apis/vectortiles/style.json @@ -126,170 +126,7 @@ } }, { - "id" : "edge", - "type" : "line", - "source" : "vectorSource", - "source-layer" : "edges", - "minzoom" : 6, - "maxzoom" : 23, - "paint" : { - "line-color" : "#f21d52", - "line-width" : [ - "interpolate", - [ - "linear" - ], - [ - "zoom" - ], - 13, - 0.1, - 23, - 6.0 - ], - "line-offset" : [ - "interpolate", - [ - "linear" - ], - [ - "zoom" - ], - 13, - 0.4, - 23, - 7.0 - ] - }, - "filter" : [ - "in", - "class", - "StreetEdge", - "AreaEdge", - "EscalatorEdge", - "PathwayEdge", - "ElevatorHopEdge", - "TemporaryPartialStreetEdge", - "TemporaryFreeEdge" - ], - "layout" : { - "line-cap" : "round", - "visibility" : "none" - }, - "metadata" : { - "group" : "Edges" - } - }, - { - "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 - }, - "filter" : [ - "in", - "class", - "StreetEdge", - "AreaEdge", - "EscalatorEdge", - "PathwayEdge", - "ElevatorHopEdge", - "TemporaryPartialStreetEdge", - "TemporaryFreeEdge" - ], - "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", - "source" : "vectorSource", - "source-layer" : "edges", - "minzoom" : 13, - "maxzoom" : 23, - "paint" : { - "line-color" : "#22DD9E", - "line-width" : [ - "interpolate", - [ - "linear" - ], - [ - "zoom" - ], - 13, - 0.2, - 23, - 8.0 - ], - "line-offset" : [ - "interpolate", - [ - "linear" - ], - [ - "zoom" - ], - 13, - 0.4, - 23, - 7.0 - ] - }, - "filter" : [ - "in", - "class", - "StreetTransitStopLink", - "StreetTransitEntranceLink", - "BoardingLocationToStopLink", - "StreetVehicleRentalLink", - "StreetVehicleParkingLink", - "StreetStationCentroidLink" - ], - "layout" : { - "line-cap" : "round", - "visibility" : "none" - }, - "metadata" : { - "group" : "Edges" - } - }, - { - "id" : "permission PEDESTRIAN", + "id" : "no-thru-traffic PEDESTRIAN", "source" : "vectorSource", "source-layer" : "edges", "type" : "line", @@ -300,7 +137,7 @@ "match", [ "get", - "permission" + "noThruTraffic" ], "NONE", "#140d0e", @@ -356,7 +193,7 @@ "string", [ "get", - "permission" + "noThruTraffic" ] ] ], @@ -367,7 +204,7 @@ "string", [ "get", - "permission" + "noThruTraffic" ] ] ] @@ -377,11 +214,11 @@ "visibility" : "none" }, "metadata" : { - "group" : "Permissions" + "group" : "No-thru traffic" } }, { - "id" : "permission BICYCLE", + "id" : "no-thru-traffic BICYCLE", "source" : "vectorSource", "source-layer" : "edges", "type" : "line", @@ -392,7 +229,7 @@ "match", [ "get", - "permission" + "noThruTraffic" ], "NONE", "#140d0e", @@ -448,7 +285,7 @@ "string", [ "get", - "permission" + "noThruTraffic" ] ] ], @@ -459,7 +296,7 @@ "string", [ "get", - "permission" + "noThruTraffic" ] ] ] @@ -469,11 +306,11 @@ "visibility" : "none" }, "metadata" : { - "group" : "Permissions" + "group" : "No-thru traffic" } }, { - "id" : "permission CAR", + "id" : "no-thru-traffic CAR", "source" : "vectorSource", "source-layer" : "edges", "type" : "line", @@ -484,7 +321,7 @@ "match", [ "get", - "permission" + "noThruTraffic" ], "NONE", "#140d0e", @@ -540,7 +377,7 @@ "string", [ "get", - "permission" + "noThruTraffic" ] ] ], @@ -551,7 +388,7 @@ "string", [ "get", - "permission" + "noThruTraffic" ] ] ] @@ -561,11 +398,11 @@ "visibility" : "none" }, "metadata" : { - "group" : "Permissions" + "group" : "No-thru traffic" } }, { - "id" : "permission-text", + "id" : "no-thru-traffic-text", "source" : "vectorSource", "source-layer" : "edges", "type" : "symbol", @@ -591,7 +428,7 @@ "layout" : { "symbol-placement" : "line-center", "symbol-spacing" : 1000, - "text-field" : "{permission}", + "text-field" : "{noThruTraffic}", "text-font" : [ "KlokanTech Noto Sans Regular" ], @@ -619,11 +456,11 @@ "visibility" : "none" }, "metadata" : { - "group" : "Permissions" + "group" : "No-thru traffic" } }, { - "id" : "no-thru-traffic PEDESTRIAN", + "id" : "permission PEDESTRIAN", "source" : "vectorSource", "source-layer" : "edges", "type" : "line", @@ -634,7 +471,7 @@ "match", [ "get", - "noThruTraffic" + "permission" ], "NONE", "#140d0e", @@ -690,7 +527,7 @@ "string", [ "get", - "noThruTraffic" + "permission" ] ] ], @@ -701,7 +538,7 @@ "string", [ "get", - "noThruTraffic" + "permission" ] ] ] @@ -711,11 +548,11 @@ "visibility" : "none" }, "metadata" : { - "group" : "No-thru traffic" + "group" : "Permissions" } }, { - "id" : "no-thru-traffic BICYCLE", + "id" : "permission BICYCLE", "source" : "vectorSource", "source-layer" : "edges", "type" : "line", @@ -726,7 +563,7 @@ "match", [ "get", - "noThruTraffic" + "permission" ], "NONE", "#140d0e", @@ -782,7 +619,7 @@ "string", [ "get", - "noThruTraffic" + "permission" ] ] ], @@ -793,7 +630,7 @@ "string", [ "get", - "noThruTraffic" + "permission" ] ] ] @@ -803,11 +640,11 @@ "visibility" : "none" }, "metadata" : { - "group" : "No-thru traffic" + "group" : "Permissions" } }, { - "id" : "no-thru-traffic CAR", + "id" : "permission CAR", "source" : "vectorSource", "source-layer" : "edges", "type" : "line", @@ -818,7 +655,7 @@ "match", [ "get", - "noThruTraffic" + "permission" ], "NONE", "#140d0e", @@ -874,7 +711,7 @@ "string", [ "get", - "noThruTraffic" + "permission" ] ] ], @@ -885,7 +722,7 @@ "string", [ "get", - "noThruTraffic" + "permission" ] ] ] @@ -895,11 +732,11 @@ "visibility" : "none" }, "metadata" : { - "group" : "No-thru traffic" + "group" : "Permissions" } }, { - "id" : "no-thru-traffic-text", + "id" : "permission-text", "source" : "vectorSource", "source-layer" : "edges", "type" : "symbol", @@ -925,7 +762,7 @@ "layout" : { "symbol-placement" : "line-center", "symbol-spacing" : 1000, - "text-field" : "{noThruTraffic}", + "text-field" : "{permission}", "text-font" : [ "KlokanTech Noto Sans Regular" ], @@ -953,7 +790,170 @@ "visibility" : "none" }, "metadata" : { - "group" : "No-thru traffic" + "group" : "Permissions" + } + }, + { + "id" : "edge", + "type" : "line", + "source" : "vectorSource", + "source-layer" : "edges", + "minzoom" : 6, + "maxzoom" : 23, + "paint" : { + "line-color" : "#f21d52", + "line-width" : [ + "interpolate", + [ + "linear" + ], + [ + "zoom" + ], + 13, + 0.1, + 23, + 6.0 + ], + "line-offset" : [ + "interpolate", + [ + "linear" + ], + [ + "zoom" + ], + 13, + 0.4, + 23, + 7.0 + ] + }, + "filter" : [ + "in", + "class", + "StreetEdge", + "AreaEdge", + "EscalatorEdge", + "PathwayEdge", + "ElevatorHopEdge", + "TemporaryPartialStreetEdge", + "TemporaryFreeEdge" + ], + "layout" : { + "line-cap" : "round", + "visibility" : "none" + }, + "metadata" : { + "group" : "Edges" + } + }, + { + "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 + }, + "filter" : [ + "in", + "class", + "StreetEdge", + "AreaEdge", + "EscalatorEdge", + "PathwayEdge", + "ElevatorHopEdge", + "TemporaryPartialStreetEdge", + "TemporaryFreeEdge" + ], + "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", + "source" : "vectorSource", + "source-layer" : "edges", + "minzoom" : 13, + "maxzoom" : 23, + "paint" : { + "line-color" : "#22DD9E", + "line-width" : [ + "interpolate", + [ + "linear" + ], + [ + "zoom" + ], + 13, + 0.2, + 23, + 8.0 + ], + "line-offset" : [ + "interpolate", + [ + "linear" + ], + [ + "zoom" + ], + 13, + 0.4, + 23, + 7.0 + ] + }, + "filter" : [ + "in", + "class", + "StreetTransitStopLink", + "StreetTransitEntranceLink", + "BoardingLocationToStopLink", + "StreetVehicleRentalLink", + "StreetVehicleParkingLink", + "StreetStationCentroidLink" + ], + "layout" : { + "line-cap" : "round", + "visibility" : "none" + }, + "metadata" : { + "group" : "Edges" } }, {