[OSM-dev] Storing way/relation start offset in PBF file

Stefan de Konink stefan at konink.de
Tue Nov 30 21:24:19 GMT 2010

Hash: SHA512

Op 30-11-10 21:26, Jochen Topf schreef:
> Sometimes it is useful to read ways before nodes or relations before way or
> nodes. With the XML format this is not really possible, but with the PBF
> format it could be reasonably easy if we store the offsets in the file where
> the way and relations start, respectively.
> If we write the offsets at the end of the file, we can still do streaming
> write. When reading from a stream you have to read everything anyway, when
> reading from a file, you can seek to the end and find out about the offsets
> and then seek there and start reading the data.
> Is this something we can fit in the existing extension mechanism? If not, its
> not a big deal, but we can note it down as possible extension in case we'll do
> a new version of the format someday.

There is currently a potential indexing extendability. What you want
would only work when everything is in fact nodes, ways, relations. But
will not work if it is ordered by: bbox(nodes, ways, relations).

I guess an index that specify the offset of each block is pretty
useless, and an index is only useful if the file is fully structured in
the 3 node, way, relation blocks. Most likely it would be much more
interesting for most users to apply a spatial index (like what is
currently being done with the Garmin maps) to the data to partition it.

Version: GnuPG v2.0.16 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/


More information about the dev mailing list