Skip to content

Simple example of parsing openstreetmap PBF files in C++

License

Notifications You must be signed in to change notification settings

eemikula/pbfparser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This is a simple example of parsing PBF files from OpenStreetMap.org in C++.

Since PBF files use Google's protobuf specification, but at the same time cannot be read from directly with the protobuf API such as with ParseFromIstream, it takes some digging through documentation and source code in order to be able to read from a file correctly.

If you have any need to read a PBF file without the use of other tools like osmosis or imposm-parser, the hope is that this might serve as a useful reference proof-of-concept.

This example works by reading the contents of PBF files from a file stream using only the bare minimum dependencies, zlib and protobuf, in order to read through a specified file and output the IDs and names of any nodes, ways, or relations that have names and are listed as being pubs, restaurants, or bars.

About

Simple example of parsing openstreetmap PBF files in C++

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published