[OSM-dev] New OSM binary fileformat implementation.

Scott Crosby scrosby06 at gmail.com
Thu Apr 29 13:45:33 BST 2010


On Thu, Apr 29, 2010 at 2:16 AM, jamesmikedupont at googlemail.com <
jamesmikedupont at googlemail.com> wrote:

> HI,
> I am working on the c++ decoder, can you please tell me roughly where
> the message objects are?
>

(CC'ing back to the list)


> I need to understand how to decode this file.
>


> Do you have any header information or is it all raw protobuf? You
> mentioned blocks being compressed, are you using the protobuf tools to
> do this? can you give me a rough layout of how to parse the bin file?
>

Parsing a protocol buffer requires knowing its length beforehand, which adds
in some complexities.

Currently a file consists of repetitions of the following:

  <32-bit integer encoding the header length, I believe it is in Java's
default big endian order>
  <serialized FileBlockHeader message>   (see fileformat.proto)
  <serialized Blob message'>  (see fileformat.proto, the length is given in
the header message)

Code implementing this is in BlockInputStream and BlockOutputStream and
FileBlock in package crosby.binary.file.
To understand how compression is used, look at the definition of the Blob
message and FileBlock.java

Inside the blob is a serialized osm HeaderBlock or osm PrimitiveBlock
message.

Note that I am currently unhappy with the current file header scheme and may
make incompatible changes.
There's definitely some cruft in fileformat.proto that needs to be removed.

thanks,
> mike
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/dev/attachments/20100429/a4473949/attachment.html>


More information about the dev mailing list