3

I would like to open a .osm.pbf using fiona in Python. I can't find much documentation on this. How can I does one do this?

I have done it using ogr2ogr.

asked Aug 18, 2014 at 22:57

1 Answer 1

5

Fiona is by design restricted to the conventional record model of data, i.e. all records (features) have the same fields associated with them. This means that Fiona reads shapefiles, but does not read more flexible formats such as the OSM PBF format.

You can check which drivers are supported in Fiona with:

import fiona
list(fiona.drivers)

You have two options then: use the OGR Python drivers to read the data, or to use ogr2ogr to convert the data to a format that Fiona can read. I think the second option is your best bet as I find Fiona much easier to use.

answered Aug 19, 2014 at 0:52
1
  • 1
    Check out gdal.org/drv_osm.html. OGR reads PBF into a temporary SQLite database. This violates my sense of what's appropriate for a library to do and so Fiona is going to keep the OSM driver turned off. Do use ogr2ogr or OSM-native software like Osmosis. Commented Aug 19, 2014 at 15:38

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.