我需要在QGIS中通过geopandas找到GeoDataFrame与其自身的交叉点。该代码在Anaconda环境中运行良好,但在QGIS python中失败。
Shapefile可通过以下链接获得:https://drive.google.com/file/d/1DQqg7Cf6AokyadkmOE8Y6k41tqDMXdmS/view?usp=drivesdk
代码如下:
df1 = gpd.GeoDataFrame.from_file("C:\\QGIS_ShapeFile1\\qgis\\laneGroup.shp")
intersection_gdf = overlay(df1, df1, how='intersection')在QGIS中,会出现以下错误:
An error has occurred while executing Python code:
AttributeError: 'NoneType' object has no attribute 'intersection'
Traceback (most recent call last):
File"C:/Users/sn43673/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\ad_qgis\shapefile_validator.py", line 318, in errorInShapeFile
intersection_gdf = overlay(df1, df2, how='intersection')File "C:\PROGRA~1\QGIS3~1.6\apps\Python37\lib\site-packages\geopandas\tools\overlay.py", line 391, in overlay
File "C:\PROGRA~1\QGIS3~1.6\apps\Python37\lib\site-packages\geopandas\tools\overlay.py", line 216, in _overlay_intersection
for k in j:
File "C:\PROGRA~1\QGIS3~1.6\apps\Python37\lib\site-packages\pandas\core\series.py", line 4042, in apply
mapped = lib.map_infer(values, f, convert=convert_dtype)
File "pandas\_libs\lib.pyx", line 2228, in pandas._libs.lib.map_infer
File "C:\PROGRA~1\QGIS3~1.6\apps\Python37\lib\site-packages\geopandas\tools\overlay.py", line 216, in
for k in j:
AttributeError: 'NoneType' object has no attribute 'intersection'发布于 2019-10-15 14:04:09
我最近遇到了这个错误。这是由于RTree包中的DLL问题造成的。您应该尝试替换libspatialindex.dll文件。
https://stackoverflow.com/questions/58352398
复制相似问题