[postgis-users] about st_distance

Obe, Regina robe.dnd at cityofboston.gov
Fri Oct 3 10:49:46 PDT 2008


Francisco,

ST_Distance (you can think of as min distance) returns the shortest distance between 2 geometries.  So between a point 
and a poly, if the point is in the poly the distance will be 0, it its outside it would be the distance between the closest point on the surface of the poly and the point. (there is actually another distance which no one asks about ST_MaxDistance - which is between the most distant point of a poly to a point - anyway I just mention it, but you wouldn't want to use it here).

Your below query won't use indexes since ST_Distance doesn't use an index.  Use ST_Dwithin instead 


SELECT p.gid as id_parcela,tipo as tipo_Pozo 
FROM selepozo(1,1) po,parcelas p 
WHERE ST_DWithin(p.the_geom, po.the_geom, 1) 

http://postgis.refractions.net/documentation/manual-svn/ST_DWithin.html

Hope that helps,
Regina
-----Original Message-----
From: postgis-users-bounces at postgis.refractions.net on behalf of fsalas
Sent: Fri 10/3/2008 7:01 AM
To: postgis-users at postgis.refractions.net
Subject: [postgis-users] about st_distance
 
Hi,

I need to know about obtain distance between polygon( parcels) and point

I Use the next sentences 

SELECT p.gid as id_parcela,tipo as tipo_Pozo FROM selepozo(1,1) po,parcelas p WHERE ST_distance(p.the_geom, po.the_geom) < 1

I have some questions 

This distance is between centroide of parcels to point or between border of parcels to point ?



Best Regards,

Francisco Salas 


___________________________________
Dpto de Sistemas Informáticos
Oficina Central Grupo Empresarial GEOCUBA
Este mensaje esta libre de virus. 
Revisado por Kaspersky Antivirus
----------------------------------------------------------------------
Engine version:  4.0.1.14
Engine date:  2002/06/25
Definition count:  1148493
Definition date:  2008/10/03
MDAV version: 2.2.8






-----------------------------------------
The substance of this message, including any attachments, may be
confidential, legally privileged and/or exempt from disclosure
pursuant to Massachusetts law. It is intended
solely for the addressee. If you received this in error, please
contact the sender and delete the material from any computer.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20081003/1222984a/attachment.html>


More information about the postgis-users mailing list