HOW TO
The following script selects overlapping features in a polygon theme.
Code:
'-- Script: OverlapPoly.ave
'-- This script selects all polygons in a theme that
'-- overlap any other polygons in that same theme.
theView = av.getactivedoc
theTheme = theView.Getactivethemes.get(0)
theFTab = theTheme.GetFTab
numRecs = theFTab.GetNumRecords
shapefld = theFTab.FindField("Shape")
for each rec in theFTab
av.SetStatus((rec/numRecs) * 100)
av.ShowMsg("Intersecting...")
aPoly = theFTab.ReturnValue(shapefld, rec)
for each rec2 in theFTab
if (rec < rec2) '-- eliminates double-checking
then
otherPoly = theFTab.ReturnValue(shapefld, rec2)
if (otherPoly.Intersects(aPoly))
then
theArea = otherPoly.ReturnIntersection(aPoly).ReturnArea
if (theArea > 0) '-- ignores polygons that merely touch
then
theFTab.GetSelection.Set(rec)
theFTab.GetSelection.Set(rec2)
end
end
end
end
end
av.ClearStatus
av.ClearMsg
theFTab.UpdateSelection
theView.Invalidate
'-- End of Script: OverlapPoly.ave
Get help from ArcGIS experts
Download the Esri Support App