[GIS] How to loop through an array of point features

arcobjectspointvb.netvba

I have a set of point features and I wish to find the points that have common coordinates. Now I changed the code as shwon bewlo by using the IPoint and the compare method through a function. I have 2 loops with cursors. The first one should read the first point while the second loop the second point etc. How can I force the cursor of the second loop to go to the second point? I addedd another NextFeature but it did not work.The result is that all the points are the same between the 2 loops.
Thanks
Demetris

Set pFeature = pFCursor.NextFeature
Do Until pFeature Is Nothing
Set pPointA = pFeature.Shape


Set pFeature2 = pFCursor2.NextFeature
Do Until pFeature2 Is Nothing
'Set pFeature2 = pFCursor2.NextFeature


Set pPointB = pFeature2.Shape
CommonPoints = ComparePoints(pPointA, pPointB)
If CommonPoints = True Then
MsgBox "Yes"
End If

Set pFeature2 = pFCursor2.NextFeature
Loop


Function ComparePoints(pointA As IPoint, pointB As IPoint) As Boolean

If pointA.Compare(pointB) Then

    ComparePoints = True

Else

    ComparePoints = False

End If

End Function

Best Answer

Okay, based on the additional information in the comments, I am proposing another way to go about reaching the actual goal which is identifying the coincident points in a point feature class. I will now perform this feat with zero programming (cue Europe's "The Final Countdown").

  1. In ArcMap, add the point feature class in question as a layer.
  2. Use Find Identical (Data Management) on the feature layer containing the coincident points. Select the SHAPE field since we are only interested in comparing the geometry. Enter appropriate XY and Z tolerances or accept the defaults. This will produce a standalone table containing a record for each feature in the input feature class, with columns for each feature's original ObjectID (IN_FID), and a sequential value (FEAT_SEQ) that will be the same for all features that were determined to be identical.
  3. Use Frequency (Analysis) on the resulting Find Identical table. Select the FEAT_SEQ field as the frequency field. This will create another standalone table with the a field containing the count of the number of times each sequential value occured.
  4. Join the Find Identical table to the point feature layer on the OBJECTID field in the points layer and FID field in the table.
  5. Join the Frequency table to the point feature layer on the FEAT_SEQ field in the joined Find Identical table, and the FEAT_SEQ field in the Frequency table.
  6. Select by Attributes on the point feature layer all those records where FREQUENCY > 1. Congratulations, you have now identified all the coincident points! Now do something with them.

Tips: You might use the in-memory workspace ("in_memory\someData") for the two stand-alone tables since they are only needed temporarily and the number of features is small. You could also script this easily with Python!