Skip to content

Use PbfFieldDecoder for DenseNodes #2197

Closed

Description

@otbutz

Citing the OSM wiki:

In addition to granularity, the primitive block also encodes a latitude and longitude offset value. These values, measured in units of nanodegrees, must be added to each coordinate.

latitude = .000000001 * (lat_offset + (granularity * lat))
longitude = .000000001 * (lon_offset + (granularity * lon))

Where latitude is the latitude in degrees, granularity is the granularity given in the PrimitiveBlock, lat_offset is the offset given in the PrimitiveBlock, and lat/lon is encoded in a Node or delta-encoded in a DenseNode. The explanation of the equation for longitude is analogous.

The PbfBlobDecoder ignores the offset and granularity completely for DenseNodes:

ReaderNode node = new ReaderNode(nodeId, ((double) latitude) / 10000000, ((double) longitude) / 10000000);

Activity

  1. easbar commented on Dec 1, 2020

    @easbar
    Member

    I'm just curious. (Where) does this make a difference in practice / GraphHopper?

  2. otbutz commented on Dec 1, 2020

    @otbutz
    ContributorAuthor

    I couldn't see any differences so far but i don't know for which elements this kind of encoding is used in OSM 🤷‍♂️
    It's still a good idea to follow the spec in order to avoid any pitfalls.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions