Hi, How can I parse(read) a binary *.pbf extract of a country ? Do I need some additional software or I can do it with standard functions of any programming language ? Thanks asked 07 Feb '12, 14:00 MrX1 |
Well in theory you can use any programming language to parse the data without the help of any libraries. Here's a C program that does exactly that: http://m.m.i24.cc/osmconvert.c - the more usual way, however, is to use a Google Protocol Buffer library to parse the data. Ready-made OSM reading modules exist for Java, Python, and for C++ ("Osmium") among others. answered 07 Feb '12, 14:04 Frederik Ramm ♦ 2
Frederik it's amazing how quickly you create useful answer for any question. Well done. Thank you
(07 Feb '12, 14:38)
MrX1
1
The wiki page for osmconvert is also worth a read - it has links to various binary versions too.
(06 Jul '12, 11:56)
SomeoneElse ♦
|
Here's an example of parsing a .pbf file natively in Ruby: https://github.com/systemed/ruby_osmpbf answered 07 Dec '16, 17:28 Richard ♦ |
You can download Osmosis. In the bin directory drop your pbf file Create a run.bat file in notepad with following commands all on one line : osmosis --read-pbf my_map.osm.pbf --write-xml my_map.osm save bat file in the same folder and dble click on it this will create your new osm file Read instructions for more more detailed commands answered 07 Feb '12, 17:17 wilpin The question of MrX1 was about parsing a PBF file for own purposes, maybe with an own program. Your way would be correct if you just wanna convert a PBF into an OSM file. This can also be done with http://wiki.openstreetmap.org/wiki/Osmconvert ... maybe even in a more simple way.
(08 Feb '12, 16:35)
stephan75
When the user reads the instructions as recommended, he'll see that with Osmosis he can also manipulate the data. Additionally, maybe Osmembrane should be mentioned, a GUI for osmosis. Plus, http://wiki.openstreetmap.org/wiki/Osmfilter should be worth a look.
(11 Feb '12, 09:46)
malenki
|