Skip to content

why geopandas not support osm.pbf data format? #3015

Answered by martinfleis
daizzhisheng asked this question in Q&A
Discussion options

You must be logged in to vote

"can't work" is a bit vague description of the error.

GeoPandas depends on GDAL to read files. GDAL is exposed either through Fiona or Pyogrio. Whether either of them can read osm.pbf depends on whether the driver for this file format is included in GDAL and if it is enabled. Fiona generally does not include OSM driver but pyogrio does.

You may be hitting this issue, for which there is a fix coming in the next release of pyogrio or a workaround. So, with pyogrio installed using conda from conda-forge, this works:

df = geopandas.read_file(
    "http://download.geofabrik.de/europe/andorra-latest.osm.pbf",
    engine="pyogrio", 
    use_arrow=True,
)

Without use_arrow=True, this returns Feat…

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@daizzhisheng
Comment options

@daizzhisheng
Comment options

@martinfleis
Comment options

@theroggy
Comment options

Answer selected by m-richards
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
3 participants
Converted from issue

This discussion was converted from issue #3014 on September 14, 2023 08:30.