【问题标题】:importing a shapefile to python with pyshp使用 pyshp 将 shapefile 导入 python
【发布时间】:2018-06-11 14:50:39
【问题描述】:

我正在尝试使用以下代码将 shapefile“Metropolin_31Jul_0921.shp”导入 python:

    import shapefile
    stat_area_df = shapefile.Reader("Metropolin_31Jul_0921.shp")

但我不断收到此错误:

    File "C:\Users\maya\Anaconda3\lib\site-packages\shapefile.py", line 291, 
    in load
    raise ShapefileException("Unable to open %s.dbf or %s.shp." % 
    (shapeName, shapeName) )
    shapefile.ShapefileException: Unable to open Metropolin_31Jul_0921.dbf 
    or Metropolin_31Jul_0921.shp.

有人知道是什么意思吗? 我尝试添加目录,但没有帮助。

【问题讨论】:

标签: python import shapefile pyshp


【解决方案1】:

确保 shapefile 所在的目录包含所有支持文件,例如 .dbf、.shx 等。如果没有这些支持文件,.shp 将无法工作。

【讨论】:

    猜你喜欢
    • 2019-02-11
    • 1970-01-01
    • 2011-12-25
    • 1970-01-01
    • 2019-01-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-08-09
    相关资源
    最近更新 更多