[GIS] Finding minimum edge to edge distance of polygons using ArcGIS Desktop

arcgis-10.0arcgis-desktopdistancepolygon

I have a a map of about 3000 polygons in ArcGIS 10. I'm looking to find the distance between each one of them. I know how to do it using the lat and long coordinates of the centroid, but I'm looking for the shortest straight line distance from the closest edge of one polygon to the closest edge of the other polygon. Any ideas?

Best Answer

That is a nice piece of code, but not nearly as nice as (assuming your table is in geographic coordinates, if not just remove the casts to geography)

CREATE TABLE mytable_distances AS
SELECT a.id, b.id, ST_Distance(a.geom::geography, b.geom::geography) as distance
FROM mytable a, mytable b;

Have I mentioned that spatial databases rock? They do. Oh, they do.

Related Question