3

Using ArcGIS 10.4.1 a user in our department created a polygon and saved it to a feature class as shown below. The area covered is correct as at times it could overlap itself. I have calculated the number of parts of this self-intersecting feature and it only has 1 part. I also ran the Check Geometry tool and that resulted in no issues. Through ArcObjects I used the ITopologicalOperator4 on the polygon and that results in:

IsSimple=True
IsSimpleEx=True with reason=esriNonSimpleOK
IsKnownSimple=True

A couple of my questions:

  • Is this a valid polygon?
  • If so how can I programatically determine that a polygon is of this type that self-intersects?
  • Can I run the Intersect tool on itself to determine I have a polygon of this type?

enter image description here

6
  • It is valid in geodatabases and shapefiles but SDE would spit this geometry out and refuse to enter it into the database.. you should be able to work that out if the IsSimpleEx reason is Null. With it is a non-simple geometry, the overlap area becomes a hole; you could use IsKnownSimple=False then call Simplify in your ITopologicalOperator(4) which will attempt to make the geometry valid(ish) but you'd still have hole in the overlap. What do you want to end up with in the end? Commented Sep 21, 2018 at 1:06
  • 2
    That shape is certainly topologically invalid. Shapefile is one of the few formats which could store such a geometry. Most geometry libraries have an isValid test. MakeValid could corrupt such a figure (the overlaps might be treated as an XOR, so there would be an unwanted hole; you could fix this with a union to an oversize envelope and a clever Dissolve)
    – Vince
    Commented Sep 21, 2018 at 2:02
  • This is a swath of area covered by an aircraft. It is in fact how it would look like from the top view. The polygon rises in the z-axis so the swath overlaps itself but at a higher altitude.
    – sinDizzy
    Commented Sep 21, 2018 at 18:07
  • The bigger question is how do I determine that I have one of these polygons? We store them in shapefiles and geodbs.
    – sinDizzy
    Commented Sep 24, 2018 at 15:15
  • Go ahead and post the "bigger question" as a new question. FME has some good examples, not sure if one of these matches your polygon. knowledge.safe.com/articles/21674/… Commented Oct 4, 2018 at 14:37

1 Answer 1

0

Well I think I have a solution and the answer is that the polygon is and isn't topologically correct.

If I use the ArcObjects ITopologicalOperator4.IsSimple operator it results in the geometry being simple which corresponds to a valid polygon. The documentation says "Indicates whether this geometry is known (or assumed) to be topologically correct, after explicitly determining this if the geometry is not already known (or assumed) to be simple."

If I use the ArcMap Check Geometry function that results in no issues. This reports that the geometry is valid.

The reason I think these two functions result in a valid geometry is because they are using the ESRI validation method and not the OGC validation method. To test this I used the ArcGIS Pro Check Geometry function which allows you to select a validation method: ESRI OR OGC. The ESRI method passes and the OGC method returns Problem=non simple.

So, to get this working in ArcMap I used the DotSpatial libraries since they use NetTopologySuite which is OGC compliant and I don't think ESRI will add this to ArcObjects (only bugs are being fixed and no new functionality).

Here is my DotSpatial vs ArcObjects test

'first we take the ArcObjects polygon and create a WKB representation
Dim geomTemp As IGeometry = pPolygonFeature.ShapeCopy
Dim wkb As IWkb = CType(geomTemp, IWkb)
Dim wkbBytes() As Byte = New Byte(wkb.WkbSize - 1) {}
Dim byteCount As Integer = wkb.WkbSize
wkb.ExportToWkb(byteCount, wkbBytes(0))

'now we convert the WKB to a DotSpatial object
Dim wr As New NetTopologySuite.IO.WKBReader
Dim dsGeom As GeoAPI.Geometries.IGeometry = wr.Read(wkbBytes)
Dim IsValidDsGeom As Boolean = dsGeom.IsValid
Debug.Print("IsValidDsGeom={0}", IsValidDsGeom)

'check if the polygon is simple
Dim pTopo As ITopologicalOperator4 = CType(pPolygonGeom, ITopologicalOperator4)
Debug.Print("PolygonGeom is Simple={0}", pTopo.IsSimple)
Dim reas As esriNonSimpleReasonEnum
Dim IsSimpEx As Boolean = pTopo.IsSimpleEx(reas)
Debug.Print("PolygonGeom is SimpleEx={0} with reason={1}", IsSimpEx, reas)
Debug.Print("PolygonGeom is KnownSimple={0}", pTopo.IsKnownSimple)

The Debug output:

IsValidDsGeom=False
PolygonGeom is Simple=True
PolygonGeom is SimpleEx=True with reason=esriNonSimpleOK
PolygonGeom is KnownSimple=True

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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