The primitive blocks of the OSM PBF Format are stated to be independently decodable. What should be the extent of this property?

For example, should all the nodes referenced by a way be stored in the same block or does this property only applies to the string tables, lat/lon offsets and granularity attributes?

  • Probably a question for the OSM-Dev list, if the reading of the spec and and practice misalign – nmtoken Jun 7 at 15:46

This is my understanding from reading that:-

Each fileblock is self-contained, and could be successfully decoded even if all the other fileblocks disappeared.

In other words, no entity should be able to refer to an entity in another fileblock. So a relation, its ways, and those ways' nodes would all be in the same block for example. The same goes for any symbols e.g. text fields associated with these entities.

It looks as if Osmosis uses these to create chunks of up to 8000 entities at a time.

That suggests that even if a pbf file was corrupted somehow, the undamaged blocks could still be decoded.

  • This is also my understanding and it would be very usefull. However, it is apparently not the case in practice. The existing OSM importers, such as osm2pgsql or imposm3, all seem to create a full node cache before importing ways and relations. – Bertil Chapuis Jan 4 at 13:48
  • In its README, imposm3 event states that "it is necessary to store all nodes to build ways and relations ", which seems to contradict the specification of the OSM PBF format. – Bertil Chapuis Jan 4 at 14:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.