错误
尝试使用 Python 脚本运行融合工具失败,并返回以下错误:
错误: 拓扑无效 [无法打开缓存文件]
以下为代码片段示例:
logging.info("Merging layers") arcpy.Merge_management(layersForMerge, mergeFC) logging.info("Buffering merged feature class") arcpy.Buffer_analysis(mergeFC, bufferFC, "30 Meters", "FULL", "ROUND", "NONE", "", "PLANAR") logging.info("Dissolving buffer feature class (this may take a while)...") arcpy.Dissolve_management(bufferFC, dissolvedFC, "", "", "MULTI_PART", "DISSOLVE_LINES") arcpy.Delete_management(bufferFC)
如果运行 ArcMap 的计算机内存不足,无法运行 Dissove_management() 工具,则会返回该错误。
为防止发生该错误,请清除融合工具的内存。 可以使用 Delete_management() 函数来删除先前占用内存空间的进程,并添加垃圾收集 Python 函数 gc.collect() 来释放内存,从而完成上述操作。 以下是用于执行此操作的代码片段示例:
logging.info("Merging layers") arcpy.Merge_management(layersForMerge, mergeFC) logging.info("Buffering merged feature class") arcpy.Buffer_analysis(mergeFC, bufferFC, "30 Meters", "FULL", "ROUND", "NONE", "", "PLANAR") logging.info("Dissolving buffer feature class (this may take a while)...") arcpy.Delete_management(mergeFC) gc.collect() arcpy.Dissolve_management(bufferFC, dissolvedFC, "", "", "MULTI_PART", "DISSOLVE_LINES") arcpy.Delete_management(bufferFC)
获取来自 ArcGIS 专家的帮助
下载 Esri 支持应用程序
You can also download the app to access the chatbot anytime! Download it now.