-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Elevation handling improvements #4033
Elevation handling improvements #4033
Conversation
StreetVertex used a lambda to pass String parameters to LocalizedString(), which meant that toString() wasn't overridden. By using I18NString parameters in LocalizedString the need for the lambda is removed, while generalising the code.
This allows testing the elevation related functionality on an actual graph.
WalkStep also contains the elevation, but having it explicitly on Leg simplifies its usage. An explicit NaN value is added to differentiate when there is no elevation data.
Due to the elevation data it is possible to have Infinity / NaN bicycleSafetyFactor or edge traversal weight. To avoid errors latter on, check for invalid values when setting updated values. ElevationProfileFailure items are added to the issue store.
NoDataGridCoverage is added which throws a PointOutsideCoverageException() if the value at a given point is the NO_DATA value for the loaded file.
This simplifies edge splitting since less cases need to be handled, while also allowing for cleaner code.
When the from/to vertices are along the same edge a partial TemporaryPartialStreetEdge was created without copying the properties from the original StreetEdge. This remedies the oversight by: * moving the responsibility from SameEdgeAdjuster to StreetEdge * and reusing StreetEdge#copyPropertiesToSplitEdge()
All elevation profiles were compacted, which caused the uncompacted profile to have differing distances. By compacting only "computed" elevations this is avoided.
The existing logic is modified so that is deterministic and tested. The new logic interpolates the elevation for each vertex that is within maxElevationPropagationDistance on the street network using the two closest vertices with elevation.
* The elevation profile as a comma-separated list of x,y values. x is the distance from the start of the leg, y is the elevation at this | ||
* distance. | ||
*/ | ||
public String legElevation; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we use some more efficient data structure for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't that what the WalkStep also uses?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is, but for example the same encoded polylines could be used as for the legGeometry
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Encoded polyline can't be used due to the different ranges the numbers have, so the existing string seems like the best solution, and so can stay the same.
Why '[changelog skip]' ? This seems relevant to include to me. |
src/main/java/org/opentripplanner/inspector/ElevationEdgeRenderer.java
Outdated
Show resolved
Hide resolved
src/main/java/org/opentripplanner/routing/edgetype/StreetEdge.java
Outdated
Show resolved
Hide resolved
I'm not sure which parts should be in the changelog, and which parts shouldn't. I can rename the PR to better reflect what should be in the changelog, or create separate PRs for the relevant parts. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really thorough refactoring and bugfix with great test coverage. Thanks!
Summary
This is a set of related changes to improve elevation handling. It fixes several bugs, along with adding new features.
Bugs
MissingElevationHandler
) and refactored so that it is deterministic and testable. A new build parameters is added to limit the propagation distance (maxElevationPropagationMeters
).StreetEdge
andStreetWithElevationEdge
, along with moving the partial edge splitting toStreetEdge
.StreetEdge
s was compacted. For split edges and propagated elevations the profile doesn't have uniform distances, which is required for compaction.StreetElevationExtension
can store both the compacted and uncompacted profile.Features
NO_DATA
tag to mark areas without elevation data. This was ignored, resulting in areas with unrealistic elevation. ANoDataGridCoverage
class is added, which treatsNO_DATA
areas the same as areas outside the grid's bounds.DataImportIssueStore
.Leg#legElevation
is added, which contains the elevation profile for the wholeLeg
. If the elevation is missing in some segments, thanNaN
segments are added.Graph#minElevation
andGraph#maxElevation
to have a consistent coloring between tiles.Refactors
StreetWithElevationEdge
is merged intoStreetEdge
, with the elevation specific parts moved intoStreetElevationExtension
. This was needed to simplify edge splitting, which previously discarded the elevation details.Issue
closes #3862
Unit tests
Unit tests are added for:
A snapshot test is added for planning trips with elevation data.
Code style
☑️
Documentation
A single new
build-config.json
parameter is added (maxElevationPropagationMeters
), for which the documentation is updated.