HOW TO

Check for overlapping features in a polygon shapefile

Last Published: April 25, 2020

Summary

The following script selects overlapping features in a polygon theme.

Procedure



  1. Copy the following code into a script window:

    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

  2. Attach the script to a button on the view GUI.

    A. Compile the script.
    B. Switch to the Project window.
    C. Select Customize from the Project menu.
    D. On the Customize dialog box, click the Type dropdown arrow and click View.
    E. Select Buttons under Category.
    F. Click the New button.
    G. Double-click the Click property in the Customize dialog box.
    H. Type the name of the script in the Script Manager and click Select.
    I. Close the Customize dialog box.

    For more information, see "Customize dialog box" in ArcView Help.

  3. Switch to the view and make the polygon theme active.
  4. Run the script by clicking the new button.

Article ID:000002647

Software:
  • Legacy Products

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options

Discover more on this topic