Free Support Forum - aspose.com

Aspose GIS overlap

Hi there I’m having a problem detecting the overlap of two polygons. I get the following error message:
System.ArgumentException: Area is not consistent for the geometry.Probably polygon rings intersect each other at coordinate. Do you have any ideas why this would happen? I can’t be too specific as the code-base cannot be shared. The function being called is
myPolygon.Overlaps(anotherPolygon)

Thanks in advance.

Hello, @steve.cooper! Thank you for your question.

Unfortunately, we have not yet encountered such a problem. So, we need some data to diagnose the issue. Please consider the following code snippet:

        try
        {
            myPolygon.Overlaps(anotherPolygon);
        }
        catch (Exception e)
        {
            // print polygons
            // Console.WriteLine(myPolygon.AsText());
            // Console.WriteLine(anotherPolygon.AsText());
            
            // put polygons in an error text
            var builder = new StringBuilder();
            builder.AppendLine("myPolygon:");
            builder.AppendLine(myPolygon.AsText());
            builder.AppendLine("anotherPolygon:");
            builder.AppendLine(anotherPolygon.AsText());
            throw new Exception(builder.ToString(), e);
        }

Could you please embed this code in your program and share the data it returns? Thanks.