"""
Name: EdgematchFeatures_example_script2.py
Description: Performs edgematching spatial adjustment using links produced by
GenerateEdgematchLinks. The links go from input features to adjacent
features. The links are then checked for intersecting conditions, which
may not be desired. They are then used to adjust input features
(a copy is made) to connect to the matched adjacent features.
"""
import arcpy
arcpy.env.overwriteOutput = True
arcpy.env.workspace = r"D:\conflationTools\ScriptExamples\data.gdb"
inFeatures = "roads1"
adjFeatures = "roads2"
gelOutput = "gelinks_out"
search_distance = "200 Feet"
match_fields = "NAME ROAD_NAME"
qaLocations = "qa_locations"
arcpy.edit.GenerateEdgematchLinks(inFeatures, adjFeatures, gelOutput, search_distance, match_fields)
"""
Note 1: The result of GenerateEdgematchLinks may contain errors; see the tool reference.
Inspection and editing may be necessary to ensure correct links before using
them for edgematching.
One of the possible errors is intersecting or touching links.
Their locations can be found by the process below.
"""
arcpy.analysis.Intersect(gelOutput, qaLocations, "", "", "POINT")
arcpy.management.DeleteIdentical(qaLocations, "Shape")
"""
Note 2: You can manually inspect locations in qaLocations and delete or
modify links as needed.
"""
inFeature_Copy = inFeatures + "_Copy"
arcpy.management.CopyFeatures(inFeatures, inFeature_Copy)
arcpy.edit.EdgematchFeatures(inFeature_Copy, gelOutput, "MOVE_ENDPOINT")