# -*- coding: utf-8 -*-
import arcpy
import sys
import os
reload(sys)
sys.setdefaultencoding("utf-8")
path = arcpy.GetParameterAsText(0)
arcpy.env.workspace = path
out_name = "MustNotOverlap_MustNotOverlapWith"
if arcpy.Exists(os.path.join(path, out_name)):
arcpy.Delete_management(os.path.join(path, out_name))
arcpy.CreateTopology_management(path, out_name)
in_topology = os.path.join(path, out_name)
feature_classes = arcpy.GetParameterAsText(1)
feature_classes = feature_classes.split(";")
for feature_class in feature_classes:
arcpy.AddFeatureClassToTopology_management(in_topology, feature_class, "1", "1")
for i in range(len(feature_classes)):
rule_type = "Must Not Overlap (Area)"
arcpy.AddRuleToTopology_management(in_topology, rule_type, feature_classes[i], "", "", "")
for j in range(i + 1, len(feature_classes)):
rule_type = "Must Not Overlap With (Area-Area)"
arcpy.AddRuleToTopology_management(in_topology, rule_type, feature_classes[i], "", feature_classes[j], "")
arcpy.ValidateTopology_management(in_topology)
Python实现多要素类自重叠与相互重叠拓扑检查
最新推荐文章于 2024-07-25 00:08:05 发布