# Self-Intersecting Detect and Fix using SimplifyAsFeature

2211
1
03-16-2021 09:04 AM
by
Occasional Contributor III

I have discovered that some of the polygons that users are bringing into my system and creating a new object from have self intersections.  I need to be able to first detect if a self intersection exists, and if it does then repair it automatically.

Is SimplifyAsFeature the best method to do this with for both detection and fixing?

protected Geometry FixSelfIntersections(Geometry inGeometry)
{
//I want to see if it has self intersections FIRST??
bool isSelfIntersecting  = NEED TO FIND FIRST??;

//Fix if it has intersections
if (isSelfIntersecting)
{
inGeometry = GeometryEngine.Instance.SimplifyAsFeature(inGeometry, true);
}

return inGeometry;
}

Tags (1)
1 Solution

Accepted Solutions
Esri Contributor

Hi,

You can use the GeometryEngine.Instance.IsSimpleAsFeature method to determine whether the feature is "simple".  (ie does not have self-intersections).  If the feature is not simple then you would call GeometryEngine.Instance.SimplifyAsFeature to simplify it.

https://pro.arcgis.com/en/pro-app/latest/sdk/api-reference/#topic15566.html

The Geometry Concepts page has a section describing these two methods

https://github.com/Esri/arcgis-pro-sdk/wiki/ProConcepts-Geometry#simplifyasfeature-and-issimpleasfea...

Thanks

Narelle

Esri Contributor

Hi,

You can use the GeometryEngine.Instance.IsSimpleAsFeature method to determine whether the feature is "simple".  (ie does not have self-intersections).  If the feature is not simple then you would call GeometryEngine.Instance.SimplifyAsFeature to simplify it.

https://pro.arcgis.com/en/pro-app/latest/sdk/api-reference/#topic15566.html

The Geometry Concepts page has a section describing these two methods

https://github.com/Esri/arcgis-pro-sdk/wiki/ProConcepts-Geometry#simplifyasfeature-and-issimpleasfea...

Thanks

Narelle