I would like to know how to determine if two geometric figures (the_geom) are approximately equals.
By the way, I'm working with Python, PostgreSQL and Postgis
I have the following geometries:
0101000020110F0000FE546AD2413E5EC16D56617C93C74FC1
0101000020110F00009D7E6384413E5EC10185DD7F93C74FC1
When I see both figures on the map, the variation is imperceptible.
Any idea?
Answer
Might want to try HausdorffDistance. Suited for this kind of question.
SELECT ST_HausdorffDistance('0101000020110F0000FE546AD2413E5EC16D56617C93C74FC1'::geometry, '0101000020110F00009D7E6384413E5EC10185DD7F93C74FC1'::geometry);
Detailed here:
http://postgis.net/docs/ST_HausdorffDistance.html
And as explained at /wiki/Hausdorff_distance:
Informally, two sets are close in the Hausdorff distance if every point of either set is close to some point of the other set. The Hausdorff distance is the longest distance you can be forced to travel by an adversary who chooses a point in one of the two sets, from where you then must travel to the other set. In other words, it is the greatest of all the distances from a point in one set to the closest point in the other set.
No comments:
Post a Comment