Skip to content

Fix PathDetails exception for empty EdgeIdDs list - #1240

Merged
karussell merged 4 commits into
graphhopper:masterfrom
boldtrn:pathdetails_bug
Dec 13, 2017
Merged

karussell merged 4 commits into
graphhopper:masterfrom
boldtrn:pathdetails_bug

Conversation

@boldtrn

@boldtrn boldtrn commented Dec 9, 2017

Copy link
Copy Markdown
Member

If you request a route with two points, with start and end being the same snapped_point, the resulting path has only one point and no edges.

This resulted in an exception:

java.lang.IllegalStateException: PathDetails time must not be empty
at com.graphhopper.PathWrapper.addPathDetails(PathWrapper.java:258)

This PR proposes a possible solution for this by allowing to set empty PathDetails in the PathWrapper.

Due to this change the resulting PathDetails will be empty:

details: {
average_speed: [ ]
},

@boldtrn boldtrn added the bug label Dec 9, 2017

@karussell karussell left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Is there a fundamental difference to a via-point with zero length and just a single point? Shouldn't it be more like [0,0,value]?


public PointList simplify() {
if (listsToSimplify.isEmpty() || pointList.isEmpty())
if (listsToSimplify.isEmpty() || pointList.isEmpty() || pointList.size() <= 2)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pointList.isEmpty is not necessary anymore

@karussell karussell added this to the 0.10 milestone Dec 10, 2017
@boldtrn

boldtrn commented Dec 13, 2017

Copy link
Copy Markdown
Member Author

Is there a fundamental difference to a via-point with zero length and just a single point?

Yes, for via points we know the value of the edge and if we merge the PathDetails this case is automatically resolved. For empty paths we don't know the value of the edge and cannot create a PathDetail like [0,0,value].

@karussell

karussell commented Dec 13, 2017 •

Copy link
Copy Markdown
Member

For empty paths we don't know the value of the edge and cannot create a PathDetail like [0,0,value].

IF both points are on an edge this is solvable (time delta is 0, fetch closest edge to get other path details etc). But when I'm think about this deeper, the problem is if both points are exactly on a tower node so that e.g. street_name value is not decidable, so an empty path detail is the only solution IMO

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants