This is a static archive of our old OpenStreetMap Help Site. Please post any new questions and answers at community.osm.org.

Interpreting PBF file node ids

1

Hi, I'm trying to parse PBF country file and I'm having trouble interpreting node ids. They should be 'delta-encoded', but for each DenseNodes group they go from 0 to 8000. Since there are many DenseNodes groups in the file, this results with many duplicate IDs. If I understood the PBF format description correctly, where it says "x_1, x_2, x_3, I encode x_1, x_2-x_1, x_3-x_2, ...", the first node ID should be a 'real' node id, and the subsequent ones should be delta-encoded.

Can someone shed some light on this?

Thanks

asked 12 Jan '16, 13:52

zepe's gravatar image

zepe
31112
accept rate: 0%

edited 25 Mar '16, 11:19

aseerel4c26's gravatar image

aseerel4c26 ♦
32.6k18248554


One Answer:

6

First, you should probably not try to re-invent the wheel and use one of the existing libraries to read PBF files. Getting all the corner cases right isn't as easy as it looks. There are libraries for several languages available. (Shameless plug: if you use C++ I can recommend my libosmium.) If you still want to do your own you can still look at those implementations to help find your problem

Second: Your interpretation is right. I guess your code is doing something different than that.

answered 12 Jan '16, 14:15

Jochen%20Topf's gravatar image

Jochen Topf
5.2k55074
accept rate: 31%

edited 13 Jan '16, 18:55

mmd's gravatar image

mmd
5.7k15388

Source code available on GitHub .