Skip to content

Add 100m radius restriction to point hint matches - #1935

Merged
karussell merged 2 commits into
graphhopper:masterfrom
samruston:point_hint_radius
Feb 28, 2020
Merged

karussell merged 2 commits into
graphhopper:masterfrom
samruston:point_hint_radius

Conversation

@samruston

Copy link
Copy Markdown
Contributor

Fixes #1828

NameSimilarityEdgeFilter has a circle of radius 100m around the original point. It then looks up the bounding box of the edges and see if they intersect with the circle. This is to help the issue where for some reason or another, it fails to match with the correct road and ends up matching one far away.

I've added a test to make sure it only matches nearby points. For the majority of the matching tests we're only testing name similarity so I used a mock node access that gives 0 distance between the nodes and overloaded the methods.

@karussell

Copy link
Copy Markdown
Member

Thanks!
Can you add yourself to the CONTRIBUTORS file and send us your Email (so we can send you the CLA)? See our contributing guide for the background details.

@samruston

Copy link
Copy Markdown
Contributor Author

Added to contributors #1937 and email sent

@karussell karussell added this to the 1.0 milestone Feb 28, 2020

@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, looks good - see my comments!

}

private static BBox createBBox(NodeAccess na, EdgeIteratorState edgeState) {
public static BBox createBBox(NodeAccess na, EdgeIteratorState edgeState) {

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.

This would be better to duplicate and keep private

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed

this.rewriteMap = rewriteMap;
this.nodeAccess = nodeAccess;
this.pointHint = prepareName(removeRelation(pointHint == null ? "" : pointHint));
this.pointCircle = new Circle(point.lat, point.lon, WITHIN_RADIUS_METERS);

@karussell karussell Feb 28, 2020 •

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.

Can you make the radius configurable i.e. just move to a constructor parameter (and call it with 100 in the templates or something)?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed

@samruston
samruston requested a review from karussell February 28, 2020 14:47
@karussell
karussell merged commit 7d1f8c8 into graphhopper:master Feb 28, 2020
@karussell

Copy link
Copy Markdown
Member

Thanks!

@easbar

easbar commented May 6, 2020 •

Copy link
Copy Markdown
Member

This improved routing performance btw, for example something like 10% for CH routing with hints 👍

@samruston

Copy link
Copy Markdown
Contributor Author

Awesome 😄

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

point_hint not precise enough

3 participants