前言
对于使用arcgis的人来说,拓扑检查是必不可少的,下面介绍一种使用model的方式来进行拓扑检查
一、拓扑检查的方法
1. 在数据集上右键按照向导建立拓扑;
2. 使用拓扑工具的一系列工具分布建立;
3. 创建模型工具,制作专门的拓扑工具;
4. 利用arcpy灵活定制拓扑检查jio本;
5. 使用AE中ITopologyContainer等接口二次开发。
二、必要步骤
无论使用哪种方式,拓扑检查都离不开以下的步骤:
- 创建拓扑:在数据基上新建一个用于拓扑的容器;
- 添加要素类:必须将需要参与拓扑检查的要素添加到同意数据集的拓扑容器中;
- 设置容差:根据情况设置,若不设置有默认值;
- 添加拓扑规则:根据要检查要素添加点、线、面的拓扑规则;
- 验证拓扑:如果前面步骤没有报错,表示拓扑完成,可以开始验证了;
- 查看结果:,可能通过拓扑工具条查看拓扑结果,也可以导出为错误要素记录;
- 修改错误:拓扑检查的目的就是修改拓扑错误,不同的错误有相应的修改方式。
三、在arcmap中使用model创建一个简单的拓扑检查
-
创建文件数据库–>创建要素数据集–>导入需要参与拓扑检查的要素,这里做的测试数据,有三处面重合的拓扑错误,自己创建的时候可以添加一个有面缝隙的错误进行测试多个拓扑规则的添加
-
打开model工具进行建模,使用到的工具主要在,数据管理工具箱中的拓扑工具箱。
-
创建拓扑:
-
添加参与拓扑检查的要素
-
设置容差
-
添加拓扑检查规则
-
验证拓扑
按照上诉步骤将工具拖入model进行设置输入输出即可得到下面的model:
点击model中的右上角运行得到的拓扑如图:
上述步骤需要注意的是:model需要保存在工具箱中,不能保存在文件夹中,建立好的拓扑检查model也可以导出为python脚本,在python中运行也可。
里面有些变量重复了,稍微修改即可。
# -*- coding: utf-8 -*-
# ---------------------------------------------------------------------------
# topotest3.py
# Created on: 2020-10-26 14:34:31.00000
# (generated by ArcGIS/ModelBuilder)
# Description:
# ---------------------------------------------------------------------------
# Set the necessary product code
import arceditor
# Import arcpy module
import arcpy
# Local variables:
data = "C:\\Users\\curse\\Desktop\\tptest\\tptest.gdb\\data"
test = "C:\\Users\\curse\\Desktop\\tptest\\tptest.gdb\\data\\test"
test__2_ = "C:\\Users\\curse\\Desktop\\tptest\\tptest.gdb\\data\\test"
test__3_ = "C:\\Users\\curse\\Desktop\\tptest\\tptest.gdb\\data\\test"
toporesult = "C:\\Users\\curse\\Desktop\\tptest\\tptest.gdb\\data\\toporesult"
toporesult__2_ = "C:\\Users\\curse\\Desktop\\tptest\\tptest.gdb\\data\\toporesult"
toporesult__3_ = "C:\\Users\\curse\\Desktop\\tptest\\tptest.gdb\\data\\toporesult"
toporesult__4_ = "C:\\Users\\curse\\Desktop\\tptest\\tptest.gdb\\data\\toporesult"
toporesult__6_ = "C:\\Users\\curse\\Desktop\\tptest\\tptest.gdb\\data\\toporesult"
# Process: 创建拓扑
arcpy.CreateTopology_management(data, "toporesult", "")
# Process: 向拓扑中添加要素类
arcpy.AddFeatureClassToTopology_management(toporesult, test, "1", "1")
# Process: 设置拓扑容差
arcpy.SetClusterTolerance_management(toporesult__2_, ".001")
# Process: 添加拓扑规则
arcpy.AddRuleToTopology_management(toporesult__3_, "Must Not Overlap (Area)", test__2_, "", "", "")
# Process: 添加拓扑规则 (2)
arcpy.AddRuleToTopology_management(toporesult__4_, "Must Not Have Gaps (Area)", test__3_, "", "", "")
# Process: 拓扑验证
arcpy.ValidateTopology_management(toporesult__6_, "Full_Extent")
参考文章:https://www.cnblogs.com/liweis/p/11639498.html
http://www.360doc.com/content/17/0925/09/25010725_689862935.shtml
https://blog.csdn.net/Sdnu08gis/article/details/106329939#%E6%A0%B7%E4%BE%8B%E6%95%B0%E6%8D%AE%E5%87%86%E5%A4%87