Skip to content

Simplify entire edges on import instead of just pillar nodes - #1943

Merged
karussell merged 8 commits into
graphhopper:masterfrom
msbarry:simplify-whole-edge
Mar 10, 2020
Merged

karussell merged 8 commits into
graphhopper:masterfrom
msbarry:simplify-whole-edge

Conversation

@msbarry

@msbarry msbarry commented Mar 3, 2020

Copy link
Copy Markdown
Contributor

Fix #1353 by simplifying whole edge geometries instead of just the pillar nodes. Since only edges with more than one pillar node remaining are stored in edge geometries, this ends up reducing edge geometry file size by 15-20%

This did result in some churn in the integration tests, please take a close look at those and let me know if they look OK. It also removed a case to not calculate edge distances on edges that cross the international date line - this didn't seem necessary since that code uses DistanceCalcEarth which handles these crossings correctly but let me know if I'm missing something.

assertEquals("keep left onto Eyblparkstraße", il.get(10).getTurnDescription(tr));
assertEquals("keep left onto Austraße", il.get(11).getTurnDescription(tr));
assertEquals("keep left onto Rechte Kremszeile", il.get(12).getTurnDescription(tr));
assertEquals("keep left onto Hoher Markt", il.get(4).getTurnDescription(tr));

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.

instruction 4 that went away was "continue onto Margarethenstraße"

assertEquals(30, il.size());
assertEquals("continue onto Avenue des Guelfes", il.get(0).getTurnDescription(tr));
assertEquals("continue onto Avenue des Papalins", il.get(1).getTurnDescription(tr));
assertEquals("turn slight left onto Avenue des Papalins", il.get(1).getTurnDescription(tr));

@msbarry msbarry Mar 3, 2020 •

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.

these changes are probably because by forcing simplification to always keep the closest pillar node to each tower node, we had been getting a bit more resolution on the angles into and out of each intersection.

@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.

This sounds too good to be true: less code and smaller geometry. Really nice!

Will have to test it in the next days and also go through the tests like you said.

@karussell karussell added this to the 1.0 milestone Mar 3, 2020
iter.setWayGeometry(pillarNodes);
// If the entire way is just the first and last point, do not waste space storing an empty way geometry
if (!pointList.isEmpty())
iter.setWayGeometry(pointList);

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.

at first I was creating a shallow copy excluding first and last points, but then I tried this approach of removing the first and last point as part of simplification and it was consistently faster than the shallow copy approach on a medium size ~1GB extract (US northeast)

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.

alright, looks like that wasn't safe because it needs to remove first and last point whether you simplify or not.

@karussell
karussell merged commit d6515a2 into graphhopper:master Mar 10, 2020
@karussell

Copy link
Copy Markdown
Member

Thanks again!

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.

should the DouglasPeucker be used for the whole geometry instead of only pillar nodes?

2 participants