-
Notifications
You must be signed in to change notification settings - Fork 0
Fixes bug where the only points involved in computePointAtDistanceThreshold #5
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
Conversation
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.
Looks good. I had two non-blocking suggestions. It's up to you to apply them or not, but I do think they will provide slight improvements
web-bundle/src/main/java/com/graphhopper/resources/BufferResource.java
Outdated
Show resolved
Hide resolved
web-bundle/src/main/java/com/graphhopper/resources/BufferResource.java
Outdated
Show resolved
Hide resolved
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.
lgtm!
@mdorford looks like some of the tests are failing. I see this when running locally: |
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.
Code looks fine, but looks like we need to update the tests to match
I had misunderstood the purpose of this block. I needed to return it to its previous state. |
It can happen that both the starting point and the ending point that get passed to computePointAtDistanceThreshold are points in intersections rather than points BETWEEN intersections. When this happens, computePointAtDistanceThreshold will fail because the method does two things:
PointList pointList = finalState.fetchWayGeometry(FetchMode.PILLAR_ONLY);
// Reverse geometry when starting at adjacent node
if (upstreamPath && finalState.getAdjNode() == endFeature.getNode() || !upstreamPath && finalState.getAdjNode() == endFeature.getNode()) {
pointList.reverse();
}
You can test that this is what is happening by replacing computePointAtDistanceThreshold with this logging-added modified computePointAtDistanceThreshold below and testing it on the north-carolina-latest.osm.pbf with
http://localhost:8989/buffer?point=35.1771105,-80.875977&roadName=South Boulevard&thresholdDistance=1609&buildUpstream=true
Note that the modified method shown below in this 'description' does NOT include the bug fix because it is desirable for the code to fail so that it displays the logging immediately before the failure.