Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I have a polygon feature classs with millions of records, I need to find list of overlapping or intersecting polygons in the same feature class, and how to do it efficiently?

  1. I need a ESRI Arcobjects code snippet for the same.
  2. I want to know how much percentage overlap is occured.
  3. Object ID's of overlapping polygons
  4. Attached image and requirement in pictorial view.

enter image description here

share|improve this question
If you are looking for an ArcObjects solution you will find the answer if you search the archived esri forum (forums.esri.com) or get an answer if you post of the esri forum. –  Hornbydd May 9 '13 at 11:23
I agree and thanks. I am looking for efficient solution for my case. If any ESRI experts can help me would be great. –  iamlaksh1 May 10 '13 at 17:05
@iamlaksh1 What is meaning of "percentage overlap"? Number of the intersecting Feature? Or, percentage of overlapping area for each Feature? –  Darksanta May 11 '13 at 5:59
% of overlapping area between the polygons. –  iamlaksh1 May 13 '13 at 14:38

1 Answer 1

There is what appears to be at least a partial solution provided by Gopisetti Parvathesam (in 2006) on the ArcGIS Discussion Forums:

Private Sub PolyOverlap()

    Dim pMxdoc As IMxDocument
    Set pMxdoc = ThisDocument

    Dim pMap As IMap
    Set pMap = pMxdoc.FocusMap

    Dim pLayer As ILayer
    Dim pLayer_Req As ILayer

    Dim lIdx As Long
    For lIdx = 0 To pMap.LayerCount - 1
        Set pLayer = pMap.layer(lIdx)
        'If (pLayer.Name = cmbLayers.text) Then
        If (pLayer.Name = "locality") Then   ' replace required layer.
            Set pLayer_Req = pLayer
        Exit For
        End If
    Next lIdx

    'Me.txtResults = ""

    Dim pFeatLayer As IFeatureLayer
    Set pFeatLayer = pLayer_Req

    Dim pFeatClass As IFeatureClass
    Set pFeatClass = pFeatLayer.FeatureClass

    If Not pFeatClass.ShapeType = 4 Then
        MsgBox "Please select polygon layer."
        Exit Sub
    End If

    Dim pFeatCursor As IFeatureCursor
    Set pFeatCursor = pFeatClass.Search(Nothing, True)

    Dim pSpatFilter As ISpatialFilter
    Set pSpatFilter = New SpatialFilter

    Dim pResFeatCursor As IFeatureCursor
    Dim pResFeature As IFeature

    Dim pFeature As IFeature
    Set pFeature = pFeatCursor.NextFeature
    Do While Not pFeature Is Nothing

        Set pSpatFilter.Geometry = pFeature.Shape
        pSpatFilter.GeometryField = pFeatLayer.FeatureClass.ShapeFieldName
        pSpatFilter.SpatialRel = esriSpatialRelOverlaps

        Set pResFeatCursor = pFeatLayer.Search(pSpatFilter, True)
        Set pResFeature = pResFeatCursor.NextFeature

        While Not pResFeature Is Nothing
            If Not (pFeature.OID = pResFeature.OID) Then
                MsgBox pFeature.OID & "," & pResFeature.OID
            End If

            Set pResFeature = pResFeatCursor.NextFeature

        Set pFeature = pFeatCursor.NextFeature

    MsgBox "Over."

End Sub
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.