forked from opentripplanner/OpenTripPlanner
-
Notifications
You must be signed in to change notification settings - Fork 2
G-MAP mobility profile-based routing [Review only - DO NOT MERGE] #197
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
binh-dam-ibigroup
wants to merge
122
commits into
ibi-dev-2.x
Choose a base branch
from
gmap-mobility-profile
base: ibi-dev-2.x
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 12 commits
Commits
Show all changes
122 commits
Select commit
Hold shift + click to select a range
2446026
Sketch out possible solution to get Gmap data into StreetEdge
leonardehrenfried e83a379
feat(BuildConfig): Add support for specifying a mobility profile CSV.
binh-dam-ibigroup f2a0c32
feat(MobilityProfileParser): Add class to parse mobility profile CSV.
binh-dam-ibigroup fc1a60a
refactor(MobilityProfile): Extract enum of known mobility profiles.
binh-dam-ibigroup 50982d4
refactor: Fix other type errors
binh-dam-ibigroup 10f2b58
improvement(OsmModule): List unused mobility profile costs.
binh-dam-ibigroup 939b1bf
refactor(StreetEdgeBuilder): Initialize costs to empty map.
binh-dam-ibigroup e4cfd24
refactor(MobilityProfile): Add various JS docs, update graphql schema.
binh-dam-ibigroup e200909
fix(schema.graphqls): Fix syntax
binh-dam-ibigroup 80b7c5e
refactor(RouteRequest): Propagate mobilityProfile plan query param.
binh-dam-ibigroup 922bac7
refactor(VehicleRentalUpdater): Revert changes
binh-dam-ibigroup 077aa0e
Merge branch 'dev-2.x' into gmap-mobility-profile
binh-dam-ibigroup 219dfca
Merge branch 'dev-2.x' into gmap-mobility-profile
binh-dam-ibigroup 64d521f
refactor(OsmModule): Apply refactor suggestions.
binh-dam-ibigroup 8c4e90b
refactor(schema.graphqls): Remove MobilityProfile enum.
binh-dam-ibigroup a7ca124
refactor: Apply prettier formatting
binh-dam-ibigroup 37ab3ec
Merge branch 'dev-2.x' into gmap-mobility-profile
binh-dam-ibigroup db44c89
fix(profileCost): Revert to use HashMap instead of EnumMap.
binh-dam-ibigroup fd07c16
Merge branch 'dev-2.x' into gmap-mobility-profile
binh-dam-ibigroup cdb152d
refactor(MobilityProfileParser): Adjust CSV headers and improve loggi…
binh-dam-ibigroup ad406f4
refactor(MobilityProfileParser): Move logging rows to parser class.
binh-dam-ibigroup 5de0059
improvement(OsmModule): Check reverse key for cost profile existence.
binh-dam-ibigroup 6a71d34
fix(RouteRequest): Initialize with mobility profile 'None'.
binh-dam-ibigroup 9691d98
improvement(OsmModule): Add indication of cost profile use between 2 …
binh-dam-ibigroup 53751c8
improvement(OsmModule): Print OSM node ids in edge names for testing.
binh-dam-ibigroup 1d1acef
feat(MobilityProfileRouting): Add default speeds per profile, use in …
binh-dam-ibigroup 7776c97
style: Apply prettier
binh-dam-ibigroup 85d68f9
fix(StreetEdge): Fix condition for returning default time.
binh-dam-ibigroup 3aedec0
refactor(OsmModule): Accommodate for null mobility profile test cases.
binh-dam-ibigroup 8d4ca02
fix(OsmModule): Accommodate null mobility profile data.
binh-dam-ibigroup 246a786
style(OsmModule): Apply prettier
binh-dam-ibigroup 072f384
refactor(MobilityProfile): Accommodate fixed enum typos.
binh-dam-ibigroup 454d7ac
improvement(MobilityProfileParser): Process mobility profile csv rows…
binh-dam-ibigroup 41a5077
refactor(GraphBuilder): Add comment for using OTP-built-in store
binh-dam-ibigroup e55654a
improvement(MobilityProfileRouting): Forbid ped routing on non-footways.
binh-dam-ibigroup ecdb0e9
improvement(StreetEdge): Apply mobility profiles or penalties on walk…
binh-dam-ibigroup aa07003
fix(StreetEdge): Use impedances as weight, use computed travel time o…
binh-dam-ibigroup 9c8cc4c
improvement(TemporaryPartialStreetEdge): Use distance-prorated profil…
binh-dam-ibigroup 4aa8875
refactor(StreetEdge): Remove implied iswalking condition
binh-dam-ibigroup b222617
refactor(MobilityProfileParser): Map costs by way id/from/to info/
binh-dam-ibigroup 0bc93b9
refactor(MobilityProfileData): Add from and to nodes to data structure
binh-dam-ibigroup ed33ba1
fix(MobilityProfileRouting): Map mobility profile data using way id
binh-dam-ibigroup 5d1bb62
fix(StreetEdge): Copy mobility costs when splitting street edges
binh-dam-ibigroup fbddde0
refactor: Print additional edge information.
binh-dam-ibigroup 18fedb9
Merge branch 'dev-2.x' into gmap-mobility-profile
binh-dam-ibigroup 3fcbd9d
style: Apply prettier
binh-dam-ibigroup 8a10dac
refactor(GraphBuilderDataSources): Add missing import
binh-dam-ibigroup fc51a61
docs(BuildConfiguration): Update documentation
binh-dam-ibigroup 26ec7f0
test(speedtest): Update test results
binh-dam-ibigroup 1aa614c
test(StreetEdgeWheelchairCostTest): Assume high cost for any untabula…
binh-dam-ibigroup a03c4fe
test(StreetEdgeCost): Use default high cost in more places.
binh-dam-ibigroup 8d1bb28
test(travelSearch): Add back test results
binh-dam-ibigroup 99ae5a2
test(StreetEdge*Cost): Revert tests
binh-dam-ibigroup 0fabe23
refactor(StreetEdge): Revert to upstream time calcs if mobility profi…
binh-dam-ibigroup a6868ea
refactor(MobilityProfile): Default to null profile instead of NONE.
binh-dam-ibigroup d420d65
refactor(TemporaryPartialStreetEdge): Set mobility debug name only if…
binh-dam-ibigroup c142afb
refactor(OsmModule): Assign mobility debug names if profile costs ava…
binh-dam-ibigroup 9e33f86
Merge branch 'ibi-dev-2.x' into gmap-mobility-profile
binh-dam-ibigroup 6c5e3ee
improvement(OsmModule): Implement two-way mobility costs.
binh-dam-ibigroup 00c0402
style(OsmModule): Apply prettier
binh-dam-ibigroup 5cc3a4b
refactor(MobilityProfileParser): Use EnumMap
binh-dam-ibigroup 160c140
refactor(MobilityProfileRouting): Fix temporal unit in comment.
binh-dam-ibigroup ccfea07
fix(StreetEdge): Convert mobility weights to seconds. Update comments.
binh-dam-ibigroup 808c850
style(StreetEdge): Remove unused statement, apply prettier
binh-dam-ibigroup bdec742
refactor(OSMWay): Move isFootway method to OSMWay.
binh-dam-ibigroup 1f407cd
improvement(OsmModule): Tag crosswalks with cross-street names.
binh-dam-ibigroup 30968ef
refactor(StreetEdgeBuilder): Remove unused import
binh-dam-ibigroup 48937a4
improvement(OsmModule): Move sidewalk id outside of parenthesis
binh-dam-ibigroup 06c85fc
improvement(OSMWay): Add criteria for footway, service road, marked c…
binh-dam-ibigroup e6a6dbe
refactor(StreetEdge): Assume mobility profile impedances in seconds
binh-dam-ibigroup a86b1cf
improvement(StatesToWalkStepsMapper): Collapse short 'continue' steps…
binh-dam-ibigroup 13ff3d7
refactor(StatesToWalkStepsMapper): Move comments regarding overwritin…
binh-dam-ibigroup 1288768
improvement(StatesToWalkStepsMapper): Avoid reusing crossing names in…
binh-dam-ibigroup d80e2be
improvement(OsmModule): Expand crosswalk support to slip lanes, servi…
binh-dam-ibigroup c051357
style: Apply prettier
binh-dam-ibigroup 2218a9f
Merge branch 'ibi-dev-2.x' into gmap-mobility-profile
binh-dam-ibigroup c23fc28
refactor(StatesToWalkStepsMapper): Don't recombine streets without mo…
binh-dam-ibigroup 957a724
refactor(OsmModule): Rename "crosswalk" to "crossing".
binh-dam-ibigroup 6df682f
Merge branch 'dev' into gmap-mobility-profile
binh-dam-ibigroup da79421
refactor(OsmModule): Extract logic for finding intersecting street, a…
binh-dam-ibigroup 353a534
refactor(OsmModule): Extract logic for filtering streets, add tests.
binh-dam-ibigroup c6efe6c
refactor(OsmModule): Add JavaDoc to extracted methods.
binh-dam-ibigroup 1db49ee
refactor(OsmModule): Add logic for finding continued ways.
binh-dam-ibigroup 22618bd
fix(OsmWay): Adjust marked crossing logic and tests.
binh-dam-ibigroup b9bcf36
perf(OsmModule): Cache last intersection for prev OSMWay.
binh-dam-ibigroup 23e79fb
refactor(OsmModule): Extract methods for crossing name and nearest cr…
binh-dam-ibigroup 618fcb4
refactor(OsmModule): Add other missing pieces.
binh-dam-ibigroup 49ba592
fix(StatesToWalkStepsMapper): Keep instr when xing and cont on other …
binh-dam-ibigroup 9be135b
style: Apply prettier
binh-dam-ibigroup faaa7ca
fix(StreetEdge): Check non-empty profileCode map.
binh-dam-ibigroup a4143a9
fix(MobilityProfileRouting): Allow pedestrian routing on transit plat…
binh-dam-ibigroup f78e192
style(MobilityProfileRouting): Apply prettier.
binh-dam-ibigroup f77c33f
feat(OsmImpedanceUpdater): Add basic diff logic between two impedance…
binh-dam-ibigroup aeb0362
feat(OsmImpedanceUpdater): Implement interval polling and diffing of …
binh-dam-ibigroup 8f6343d
refactor(OsmImpedanceUpdater): Include from/to nodes in change compar…
binh-dam-ibigroup 85f20cb
refactor(GraphBuilder): Remove impedance data source.
binh-dam-ibigroup a7e555c
refactor(StreetEdge): Store original OSM way ID.
binh-dam-ibigroup 0778883
refactor(StreetEdge): store profileKey for fast retrieval.
binh-dam-ibigroup 5a3fdd7
refactor(OsmImpedanceUpdater): Tweak log messages.
binh-dam-ibigroup a6f4ee1
style: Apply prettier.
binh-dam-ibigroup b667766
refactor(OsmModule): Remove debug stuff.
binh-dam-ibigroup 0f3da14
refactor(KryoBuilder): Remove mobility profile persistence.
binh-dam-ibigroup 5b56661
refactor(OsmModule): Remove unused code.
binh-dam-ibigroup 1c84582
refactor(StreetEdge): Update profileKey comment.
binh-dam-ibigroup 5128679
refactor(OsmModule): Remove build-time permission restrictions.
binh-dam-ibigroup 26a2efb
refactor(StreetEdge): Check for non-null profileCosts.
binh-dam-ibigroup 7e02c22
style(StatesToWalkStepsMapper): Apply prettier.
binh-dam-ibigroup 92a0c04
refactor(StreetEdge): Extract method to check non-null/empty profile …
binh-dam-ibigroup 5dc0635
refactor(OsmImpedanceUpdater): Improve logs and comments.
binh-dam-ibigroup 5ad796d
refactor(OsmModule): Improve logs.
binh-dam-ibigroup d6ce9c5
refactor(StatesToWalkStepMapper): Reuse hasProfileCost check.
binh-dam-ibigroup 1c47d27
refactor(StreetEdge): Propagate profile info when splitting edges.
binh-dam-ibigroup d1496be
refactor(ImpedanceUpdateHandler): Apply impedances to edges with Spli…
binh-dam-ibigroup 371ee42
feat(OsmModule): Add build option to prevent ped routing on roads.
binh-dam-ibigroup c38712b
Merge branch 'ibi-dev-2.x' into gmap-mobility-profile
binh-dam-ibigroup a8aae89
refactor: migrate types and imports.
binh-dam-ibigroup 76719d8
refactor(OsmImpedanceUpdater): Close HTTP resource factory after poll…
binh-dam-ibigroup 334a52c
refactor(MobilityProfileRoutingTest): Migrate types.
binh-dam-ibigroup 42ce24f
refactor(OsmModuleTest): Migrate types.
binh-dam-ibigroup 1533663
docs(BuildConfiguration): Update snapshot.
binh-dam-ibigroup 5404d89
refactor: Remove street name debug info.
binh-dam-ibigroup 772fdb3
style(ImpedanceUpdateHandler): Remove street name debug info.
binh-dam-ibigroup File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
49 changes: 49 additions & 0 deletions
49
src/ext/java/org/opentripplanner/ext/mobilityprofile/MobilityProfile.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| package org.opentripplanner.ext.mobilityprofile; | ||
|
|
||
| /** | ||
| * Enumeration for the mobility profiles, and their associated column names for CSV parsing. | ||
| */ | ||
| public enum MobilityProfile { | ||
| NONE("None"), | ||
| SOME("Some"), | ||
| DEVICE("Device"), | ||
| WCHAIRM("WChairM"), | ||
| WCHAIRE("WChairE"), | ||
| MSCOOTER("MScooter"), | ||
| VISION("Vision"), | ||
| VISIONPLUS("Vision+"), | ||
| SOME_VISION("Some-Vision"), | ||
| DEVICE_VISION("Device-Vision"), | ||
| WCHAIRM_VISION("WChairM-Vision"), | ||
| WCHAIRE_VISION("WChairE-Vision"), | ||
| MSCOOTER_VISION("MScooter-Vision"), | ||
| SOME_VISIONPLUS("Some-Vision+"), | ||
| DEVICE_VISIONPLUS("Device-Vision+"), | ||
| WCHAIRM_VISIONPLUS("WChairM-Vision+"), | ||
| WCHAIRE_VISIONPLUS("WChairE-Vision+"), | ||
| MSCOOTER_VISIONPLUS("MScooter-Vision+"); | ||
|
|
||
| private final String text; | ||
|
|
||
| MobilityProfile(String text) { | ||
| this.text = text; | ||
| } | ||
|
|
||
| public String getText() { | ||
| return text; | ||
| } | ||
|
|
||
| @Override | ||
| public String toString() { | ||
| return text; | ||
| } | ||
|
|
||
| public static MobilityProfile fromString(String value) { | ||
| for (MobilityProfile p : MobilityProfile.values()) { | ||
| if (p.text.equals(value)) { | ||
| return p; | ||
| } | ||
| } | ||
| throw new RuntimeException(String.format("Invalid mobility profile '%s'", value)); | ||
| } | ||
| } |
72 changes: 72 additions & 0 deletions
72
src/ext/java/org/opentripplanner/ext/mobilityprofile/MobilityProfileParser.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| package org.opentripplanner.ext.mobilityprofile; | ||
|
|
||
| import com.csvreader.CsvReader; | ||
| import com.google.common.collect.ImmutableTable; | ||
| import java.io.IOException; | ||
| import java.io.InputStream; | ||
| import java.nio.charset.StandardCharsets; | ||
| import java.util.EnumMap; | ||
| import java.util.Map; | ||
| import org.opentripplanner.street.model.vertex.VertexLabel; | ||
| import org.slf4j.Logger; | ||
| import org.slf4j.LoggerFactory; | ||
|
|
||
| /** | ||
| * Helper class that processes CSV files containing profile-based OSM costs. | ||
| */ | ||
| public class MobilityProfileParser { | ||
|
|
||
| private static final Logger LOG = LoggerFactory.getLogger(MobilityProfileParser.class); | ||
|
|
||
| private MobilityProfileParser() {} | ||
|
|
||
| /** | ||
| * Process rows from the given CSV stream and build a table indexed by both the | ||
| * upstream/downstream nodes, where each value is a map of costs by mobility profile. | ||
| */ | ||
| public static ImmutableTable<String, String, Map<MobilityProfile, Float>> parseData(InputStream is) { | ||
| try { | ||
| var reader = new CsvReader(is, StandardCharsets.UTF_8); | ||
| reader.setDelimiter(','); | ||
| reader.readHeaders(); | ||
|
|
||
| ImmutableTable.Builder<String, String, Map<MobilityProfile, Float>> tableBuilder = ImmutableTable.builder(); | ||
| int lineNumber = 1; | ||
| while (reader.readRecord()) { | ||
| parseRow(lineNumber, reader, tableBuilder); | ||
| lineNumber++; | ||
| } | ||
|
|
||
| return tableBuilder.build(); | ||
| } catch (IOException e) { | ||
| throw new RuntimeException(e); | ||
| } | ||
| } | ||
|
|
||
| private static void parseRow( | ||
| int lineNumber, | ||
| CsvReader reader, | ||
| ImmutableTable.Builder<String, String, Map<MobilityProfile, Float>> tableBuilder | ||
| ) throws IOException { | ||
| try { | ||
| long fromNode = Long.parseLong(reader.get("Upstream Node"), 10); | ||
| long toNode = Long.parseLong(reader.get("Downstream Node"), 10); | ||
|
|
||
| var weightMap = new EnumMap<MobilityProfile, Float>(MobilityProfile.class); | ||
| for (var profile : MobilityProfile.values()) { | ||
| weightMap.put(profile, Float.parseFloat(reader.get(profile.getText()))); | ||
| } | ||
|
|
||
| tableBuilder.put( | ||
| VertexLabel.osm(fromNode).toString(), | ||
| VertexLabel.osm(toNode).toString(), | ||
| weightMap | ||
| ); | ||
| } catch (NumberFormatException | NullPointerException e) { | ||
| LOG.warn( | ||
| "Skipping mobility profile data at line {}: missing/invalid data", | ||
| lineNumber | ||
| ); | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.