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:



When I see both figures on the map, the variation is imperceptible.

Any idea?

  • You're not going to be able to evaluate in WKB hexadecimal notation. You'll need to instantiate geometries and perform a functional 'diff' (buffer one by a small threshold then see if the other is WITHIN it) – Vince Apr 30 '15 at 20:25
  • Oh, and you'll probably need to go the other way (buffer other and test within one, so that incomplete overlap is found) – Vince Apr 30 '15 at 20:58

Might want to try HausdorffDistance. Suited for this kind of question.

SELECT ST_HausdorffDistance('0101000020110F0000FE546AD2413E5EC16D56617C93C74FC1'::geometry, '0101000020110F00009D7E6384413E5EC10185DD7F93C74FC1'::geometry);

Detailed here:


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.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.