An algorithm for detecting such polygons or SqlGeography objects

Does anyone have a better idea on how to discover similar polygons or geographic regions using C # and SQL Server? I am currently doing this by taking an STSymDifference (detects points that do not lie in both cases) from two SqlGeography objects, and then calculates the STArea resulting SqlGeography object as follows:

 const double maxAreaDifference = 1000.0; var diffGeography = geography1.STSymDifference(geography2); var similar = ((double) diffGeography.STArea()) < maxAreaDifference; 

Does anyone have a better algorithm? I know one more solution to determine how many percentages are the same in both forms, but it doesn’t work in my case, because the shapes can be so large that this percentage difference is in thousands of square meters. I also know that there is a SqlGeography method in STEquals , but it only works if both SqlGeography have the same set of points.

You can also see the image below the polygon on the Google map, if the next time I get a similar polygon, my algorithm should determine how similar it is.

http://i.stack.imgur.com/jGUr5.png

+4
source share

Source: https://habr.com/ru/post/1495130/


All Articles