使用ogr和SQLite解析shapefile时出错

时间:2017-09-14 11:00:56

标签: sqlite shapefile ogr

我试图根据this questionthat instruction解散shapefile。但是,当我运行我的代码行时:

ogr2ogr "c:/working/testing/dissolve.shp" "c:/working/testing/test.shp" -f"ESRI Shapefile" -dialect sqlite -sql "SELECT ST_Union(geometry) FROM 'test'"

我收到以下错误:

ERROR 1: In ExecuteSQL(): sqlite3_step(SELECT ST_Union(geometry) FROM 'temp_2'): SQL logic error or missing database

我错过了什么?

编辑:"解散" QGIS的算法工作得很好(不是使用ogr2​​ogr的,而是他们自己的)。有什么魔法我不明白吗?

1 个答案:

答案 0 :(得分:0)

好吧,我自己整理了一下。失败的原因是在shapefile中,某些功能已被标记为已删除,因此在阅读单个功能时会显示此错误消息:

ERROR 1: Attempt to read shape with feature id (0), but it is marked deleted.

我现在能够通过复制shapefile来解决这个问题,而shapefile也会重新打包并删除所有标记为此类的功能。使用这个新副本,初始代码行完全正常。

相关问题