[Qgis-user] distance between polygons

Giovanni Manghi giovanni.manghi at gmail.com
Sun Mar 14 12:42:24 PDT 2010


Hi,


On Sun, 2010-03-14 at 17:36 +0100, Johan Nilsson wrote:
> Is there a tool where you can measure shortest distance between
> polygons to another polygon or a polyline? Distance matrix seems only
> use measuring between point object.


probably the fastest way to obtain it is with postgis (a lot can be done
from within of the postgis manager plugin)

Example

SELECT ST_Distance(ST_Transform(a.the_geom,your_srid),
ST_Transform(b.the_geom,your_srid)) AS distance_between_geometries
FROM pol1 a, pol1 b 
WHERE a."attribute_name" = 'attribute_value' AND b."attribute_name" =
'attribute_value'

see
http://postgis.org/documentation/manual-1.5/ST_Distance.html


cheers

-- Giovanni --




More information about the Qgis-user mailing list