Skip to content

Use delta encoding for geometry #234

Closed

Description

@karussell

I created a branch where delta encoding for the geometry is used. This saves over 30% of the space for the geometry file which is about 10% overall savings. E.g. for world wide this saving is over 1GB.

It also seems to be slightly faster for routing (but this might be due to less RAM usage). But the location lookup is slightly slower (acceptable. probably only a tiny fraction of whole routing as now that dynamic lookup is implemented).

The only real problem is now how many bytes we need to read from the DataAccess object in order to safely read all geometry. Currently we create a small byte array and read the number of entries (points with two double values), then we create a new large byte array with num*dimension*6. And although this is very optimistic (one entry fits typically into 4 bytes due to delta encoding) but could fail in extreme cases where the points are too far away like it is in our test cases and we need to increase to 6 bytes per dimension but even 9 bytes are possible per value.

The best way would be to extend the DataAccess and implement the readXY methods directly there so that one avoids to allocate an array.

Activity

  1. karussell commented on Sep 29, 2019

    @karussell
    MemberAuthor

    Another idea is to use the encoded polyline algorithm. Here is a branch for this: https://github.com/graphhopper/graphhopper/commits/improve_waygeometry (also slower but nicely compact)

  2. karussell commented on Apr 30, 2024

    @karussell
    MemberAuthor

    For now just accept the slightly more disk and memory usage as we can increase the 4 bytes of the georef to 5 with #2993. (And if memory is rare we could force this geometry-DataAccess to type MMap instead of the default)

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions