<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7652.24">
<TITLE>RE: [postgis-users] about st_distance</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/plain format -->

<P><FONT SIZE=2>Francisco,<BR>
<BR>
ST_Distance (you can think of as min distance) returns the shortest distance between 2 geometries.  So between a point<BR>
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).<BR>
<BR>
Your below query won't use indexes since ST_Distance doesn't use an index.  Use ST_Dwithin instead<BR>
<BR>
<BR>
SELECT p.gid as id_parcela,tipo as tipo_Pozo<BR>
FROM selepozo(1,1) po,parcelas p<BR>
WHERE ST_DWithin(p.the_geom, po.the_geom, 1)<BR>
<BR>
<A HREF="http://postgis.refractions.net/documentation/manual-svn/ST_DWithin.html">http://postgis.refractions.net/documentation/manual-svn/ST_DWithin.html</A><BR>
<BR>
Hope that helps,<BR>
Regina<BR>
-----Original Message-----<BR>
From: postgis-users-bounces@postgis.refractions.net on behalf of fsalas<BR>
Sent: Fri 10/3/2008 7:01 AM<BR>
To: postgis-users@postgis.refractions.net<BR>
Subject: [postgis-users] about st_distance<BR>
<BR>
Hi,<BR>
<BR>
I need to know about obtain distance between polygon( parcels) and point<BR>
<BR>
I Use the next sentences<BR>
<BR>
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<BR>
<BR>
I have some questions<BR>
<BR>
This distance is between centroide of parcels to point or between border of parcels to point ?<BR>
<BR>
<BR>
<BR>
Best Regards,<BR>
<BR>
Francisco Salas<BR>
<BR>
<BR>
___________________________________<BR>
Dpto de Sistemas Informáticos<BR>
Oficina Central Grupo Empresarial GEOCUBA<BR>
Este mensaje esta libre de virus.<BR>
Revisado por Kaspersky Antivirus<BR>
----------------------------------------------------------------------<BR>
Engine version:  4.0.1.14<BR>
Engine date:  2002/06/25<BR>
Definition count:  1148493<BR>
Definition date:  2008/10/03<BR>
MDAV version: 2.2.8<BR>
<BR>
<BR>
<BR>
<BR>
</FONT>
</P>

</BODY>
</HTML>
<HTML><BODY><P><hr size=1></P>
<P><STRONG>
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.
</STRONG></P></BODY></HTML>

<P><hr size=1></P>
<P><STRONG><font size="2" color="339900"> Help make the earth a greener place. If at all possible resist printing this email and join us in saving paper. </p> <p> </font></STRONG></P>