python - Geopandas 在读取 shp 文件时抛出驱动错误
问题描述
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 中打开它并且它完美地拉起。
解决方案
如果其他人需要类似的信息:我也有一个合法的 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
推荐阅读
- spring - Spring 不向 SimpleUrlHandlerMapping 添加拦截器
- c - C 编译器是否保证两个八字节字段结构将在 SysV x64 上作为 INTEGER 传递?
- ssl - SSL 站点给出的通用名称无效
- python-3.x - 需要字符串类型的输出
- java - 使用 Scala 转置 Spark DataFrame
- youtube - 列出 YouTube 频道上所有播放列表中的所有视频(不下载视频或音频)
- java - 在java中运行时找不到sshpass命令
- c++ - 在 GCC/clang 上调用模板类的模板成员函数失败,但适用于 MSVC
- constants - Labview - 管理大量常量
- c++ - 如果条件检查多个向量大小相等