Dane
Dane

Reputation: 23

Geopandas throws driver error when reading shp file

Geopandas is throwing a driver error when reading a SHP file.

DriverError: '*PATH*/cb_2018_us_zcta510_500k.shp does not exist in the file system, and is not recognized as a supported dataset name.

All I am doing is this:

import geopandas
geopandas.read_file("*PATH*/cb_2018_us_zcta510_500k.shp")

The directory this pulls from includes all the other needed files downloaded from here:

https://www.census.gov/geographies/mapping-files/time-series/geo/carto-boundary-file.html

and the actual files are here: https://www2.census.gov/geo/tiger/GENZ2018/shp/cb_2018_us_zcta510_500k.zip

Just to confirm that the file is not corrupt or anything I opened it up in QGis and it pulled up perfectly.

Upvotes: 1

Views: 5171

Answers (1)

Amir Ashiri
Amir Ashiri

Reputation: 11

In case someone else needs similar info: I, too, had a legit shapefile URL, GeoPandas read_file threw an error: DriverError not recognized as a supported file format.

What worked for me is the following:

import fiona

with fiona.open('/path/to/my_shapefile.shp') as shp:
   ax = geo.plot()
   #...rest of code

Upvotes: 1

Related Questions