“Failed to parse input” from Google protocol buffers protoc command for ``--decode_raw``

假装没事ソ 提交于 2019-12-02 06:06:41

The OpenStreetMap .osm.pbf format is not a raw protocol buffer. The format is documented here:

http://wiki.openstreetmap.org/wiki/PBF_Format

Key quote:

The format is a repeating sequence of:

  • int4: length of the BlobHeader message in network byte order
  • serialized BlobHeader message
  • serialized Blob message (size is given in the header)

So you need to read four bytes first, interpret them as an integer (big-endian), then read that many bytes and parse as a BlobHeader, and that in turn will tell you how many bytes to read and parse as a Blob.

The protoc tool will not do this automatically since it doesn't know this format. Probably there is an OSM-specific tool out there that you can use.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!