首页 > 解决方案 > 无法使用 geopandas 加载 geojson 文件

问题描述

我正在尝试将 geojson 文件加载到 Jupyter 笔记本中,使用

import geopandas as gpd

country = gpd.read_file(r"‪path-to-file\svn_border.geojson")

它返回以下错误:

CPLE_OpenFailedError: '‪‪path-to-file\svn_border.geojson' does not exist in the file system, and is not recognized as a supported dataset name.

fiona\ogrext.pyx in fiona.ogrext.Session.start()

fiona\_shim.pyx in fiona._shim.gdal_open_vector()

DriverError: '‪‪path-to-file\svn_border.geojson' does not exist in the file system, and is not recognized as a supported dataset name.

我正在使用 Python 3.6.8、Fiona 1.18、GDAL 3.1.4。即使我尝试将 geojson 文件的内容上传为 json 格式,它也会给出相同的错误。

我这几天一直在处理同样的错误,有人能指出我的错误吗?

编辑:在尝试验证我拥有的 geojson 文件后,结果发现它们已损坏。我使用了一个示例 geojson 文件,效果很好。

标签: pythongeojsongdalgeopandasfiona

解决方案


推荐阅读