Self-Intersecting Detect and Fix using SimplifyAsFeature

2583
1
Jump to solution
03-16-2021 09:04 AM
MKa
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)
0 Kudos
1 Solution

Accepted Solutions
NarelleChedzey
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

View solution in original post

0 Kudos
1 Reply
NarelleChedzey
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

0 Kudos