<br><br><div><span class="gmail_quote">On 9/15/06, <b class="gmail_sendername">Michael Fuhr</b> &lt;<a href="mailto:mike@fuhr.org">mike@fuhr.org</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
On Fri, Sep 15, 2006 at 07:48:12AM -0700, Rafael Orta wrote:<br>&gt; update smarter.vow_properties set geom = makePoint (latitude, longitude);<br><br>This should be makePoint(longitude, latitude).&nbsp;&nbsp;Geometries are (X Y).<br>
<br>&gt; Looking for properties in my table that are around 100 metters from a point.<br>&gt; ==================================================<br>&gt; select * from smarter.vow_properties where geom &amp;&amp; Expand(GeomFromText('POINT( 
39.940252 -074.905868)',-1),100)<br>&gt; and Distance (GeomFromText('POINT(39.946788 -074.905868)',-1),geom) &lt; 100;<br>&gt;<br>&gt; What I am doing wrong? No matter what distance I place even 1 metter<br>&gt; it return all the rows.
</blockquote><div><br><br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Expand() and Distance() use the same units as the input geometries,
<br>which in this case is degrees, not meters.&nbsp;&nbsp;Try expanding by a small<br>fraction of a degree (0.002 should be reasonable at that latitude)<br>and use distance_sphere() instead of Distance().&nbsp;&nbsp;Alternatively,<br>transform the coordinates to an SRID that uses meter units, such
<br>as the appropriate UTM zone.<br><br>--<br>Michael Fuhr</blockquote><div><br>Once you are either using distance_sphere or are using an appropriate cartesian projection, you would then also want to add in order by distance(...) asc at the end of your statement.&nbsp; That way if you just want the closest, you could also add limit 1 to the end of that.
<br><br>David<br></div><br></div>