This is a static archive of our old OpenStreetMap Help Site. Please post any new questions and answers at community.osm.org.

Converting .pbf to .geojson with osmium

0

I've downloaded the United States .osm.pbf from Geofabrik. To convert the map data from .osm.pbf to GeoJSON, I used the following osmium command:
osmium export UNITED_STATES.pbf -o UNITED_STATES.geojson --index-type dense_file_array

The output GeoJSON appears to only contain points (e.g trees, buildings, powerlines) and no roads/polygons.

The progress bar in the terminal indicates that osmium has finished.

Do I need to include extra arguments to export other geometries?

asked 23 Jul '21, 15:48

tussiez's gravatar image

tussiez
16113
accept rate: 0%


One Answer:

2

The program isn't finished when the progress bar is finished but when the program is finished. The progress bar is, unfortunately, not working that great for osmium export. I suspect when you wait for the program to actually finish, you'll see all the data in the file.

Also: When using dense_file_array, you should add a file name: --index-type dense_file_array,nodes.dat. Otherwise the data goes into a file that you can't see which can be confusing.

answered 23 Jul '21, 16:36

Jochen%20Topf's gravatar image

Jochen Topf
5.2k55074
accept rate: 31%

I'll wait longer. When adding the file name to dense_file_array, osmium throws an argument error.
Unknown index type 'dense_file_array,index.dat'. Use --show-index-types or -I to get a list.

(23 Jul '21, 19:14) tussiez

Then your osmium is too old. There was a bug in osmium a while back but that has been fixed.

(23 Jul '21, 20:55) Jochen Topf

Source code available on GitHub .