Geographic Information Systems Asked on January 24, 2021
I have been using PostGIS 3.0. The ST_HausdorffDistance() function calculates a symmetric distance between two polygons. However, Hausdorff distance is not a metric since it is the maximum distance between the closest pairs of vertices. Therefore, it depends on the number of vertices each polygon possess. I could not understand how PostGIS made it symmetric.
In addition, when I investigated a toy dataset, where we have two polygon layers (A and B), and their corresponding vertices generated by the Coord. AttribuTable plugin of QGIS (A_vertices, B_vertices), I calculated the Hausdorff distance from A to B as 16.41 and 18.13 for polygons with IDs 111 and 222 respectively. These distances are 31.19 and 25.70 in PostGIS.
select ST_HausdorffDistance(a.geom, b.geom)
from a, b
where a.id=222 and b.id=222
PostGIS implements the Hausdorff metric (as stated in the doc), which is symmetric. It is defined as the maximum of the two Oriented Hausdorff distances between the two geometries.
It's hard to say why you might be seeing different results. If you can provide a pure SQL example that would help to see what's going on.
Correct answer by dr_jts on January 24, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP