[postgis-users] SQL syntax question
Manuel Kohout
manu.kohout at gmail.com
Sun Mar 8 14:52:58 PDT 2015
Hi,
I have found following SQL query for measuring distances between polygon
edges:
select a.gid from_gid, b.gid to_gid, st_shortestline(a.geom,b.geom),
st_distance(a.geom,b.geom) as distance
from
test.nfanwood as a,
(select * from test.nfanwood) as b
where st_dwithin(a.geom,b.geom,2000)
https://duncanjg.wordpress.com/2012/09/23/edge-to-edge-distance-using-postgis/
I am a newbie to GIS and wonder, if you could explain the syntax of the
query to me?
It works fine, when I run it with my own polygon shapefile: I receive a
table with 3 columns a-gid, b.gid and distance, containg rows with all
distances of all a.gid to all b.gid.
However, what I'd like is to add the distance from a.gid 1 to b.gid 2,
a.gid 1 to b.gid 3, ... to my existing attribute table where my 103 patches
have ID name "Island" m001 - m103.
Thus all 102 distances of island m001 to all the other 102 islands should
be added as rows with ID name m001.
Is this possible?
/Manu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20150309/b4351a50/attachment.html>
More information about the postgis-users
mailing list