I've been testing out this code to detect self-intersecting polygons in ArcPad, but I am getting inconsistent results including a LOT of false positives and some false negatives. I cannot figure out the pattern to the problem. This is based on the code here: How to determine if a polygon is self-intersecting using either ArcPad 8.0 or ArcMap 9.3.1? - Geographic Information Sys…
Is the issue trying to test this in the office, rather than with real GPS-collected data?
Sub CheckSelfIntersectingPolygon(objSH)
Dim intJ, intI, objPart, objVertex, strVertexNo
'Initialize intJ
intJ = 1
'Display information for each part of the feature
For Each objPart in objSH.Parts
'MsgBox "Part " & intJ & " contains " & objPart.Count & " vertices.",vbOKOnly," Vertex Count"
'Initialize intI
intI = 1
'Display information for each vertex in the current part
For Each objVertex in objPart
strVertexNo = "vertex(" & intI & ") " & objSH.isPointIn(objVertex)
'console.print strVertexNo
if objSH.isPointIn(objVertex) = "True" then
msgbox "This is a self intersecting polygon. You will need to recollect it."
'& VBCr & strVertexNo
exit sub
end if
'Increment intI
intI = intI + 1
Next
'Increment intJ
intJ = intJ + 1
Next
End Sub