【问题标题】:Geopandas throws driver error when reading shp fileGeopandas 在读取 shp 文件时抛出驱动错误
【发布时间】:2019-05-23 17:21:59
【问题描述】:

Geopandas 在读取 SHP 文件时引发驱动程序错误。

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

我所做的只是:

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

从中提取的目录包括从此处下载的所有其他所需文件:

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

实际文件在这里: https://www2.census.gov/geo/tiger/GENZ2018/shp/cb_2018_us_zcta510_500k.zip

只是为了确认文件没有损坏或我在 QGis 中打开它的任何内容,并且它完美地拉起。

【问题讨论】:

  • GeoPandas 在我的系统上正确导入该文件。您确定您指定的文件路径正确吗?
  • 是的,这是正确的位置。我能够将其复制粘贴到 Windows 资源管理器中,并且可以正常工作。

标签: python driver gis geopandas


【解决方案1】:

如果其他人需要类似信息:我也有一个合法的 shapefile URL,GeoPandas read_file 抛出错误:DriverError not recognized as a supported file format。

对我有用的是:

import fiona

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-01-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-05-29
    相关资源
    最近更新 更多