Hmmm....I just looked again at the points - they no longer match the original lat/lon coordinates, could I have somehow altered these via reprojecting them?<br clear="all">Bo Coughlin<br><a href="mailto:bo@rekindl.com">bo@rekindl.com</a><br>
704.414.0805<br>
<br><br><div class="gmail_quote">On Thu, Jul 9, 2009 at 1:38 PM, Bo Coughlin <span dir="ltr"><<a href="mailto:bo@rekindl.com">bo@rekindl.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Tried - got nothing returned...little scary. - bo<div><br></div><div><div class="im"><br clear="all">Bo Coughlin<br><a href="mailto:bo@rekindl.com" target="_blank">bo@rekindl.com</a><br></div>704.414.0805<div><div></div>
<div class="h5">
<br>
<br><br><div class="gmail_quote">On Thu, Jul 9, 2009 at 1:16 PM, Paul Ramsey <span dir="ltr"><<a href="mailto:pramsey@cleverelephant.ca" target="_blank">pramsey@cleverelephant.ca</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Try this:<br>
<br>
--<br>
-- ST_DWithin_Sphere(lonlat-point, lonlat-point, radius-in-meters)<br>
returns boolean<br>
--<br>
-- Meters/Degree @ 60N: select 1/distance_sphere('POINT(0<br>
60)','POINT(1 60)') = 1.79866403673916e-05<br>
--<br>
CREATE OR REPLACE FUNCTION ST_DWithin_Sphere(geometry, geometry, float8)<br>
RETURNS boolean<br>
AS 'SELECT $1 && ST_Expand($2,$3 * 1.79866403673916e-05) AND<br>
$2 && ST_Expand($1,$3 * 1.79866403673916e-05) AND<br>
ST_Distance_Sphere($1, $2) < $3'<br>
LANGUAGE 'SQL' IMMUTABLE;<br>
<div><br>
<br>
SELECT <a href="http://m.id" target="_blank">m.id</a> AS mid,<br>
m.building_i AS mb_id,<br>
<a href="http://c.id" target="_blank">c.id</a> AS cid, c.building_i AS cb_id,<br>
m.streetaddr AS m_address,<br>
m.city AS m_city,<br>
m.state AS m_state,<br>
m.zip AS m_zip,<br>
m.zip4 AS m_zip4,<br>
round(CAST(<br>
</div>ST_Distance_Sphere(m.the_geom, c.the_geom)<br>
<div>AS numeric), 2) AS dist_meters<br>
FROM market_locations m, customer_locations c<br>
</div>WHERE st_dwithin_sphere(m.the_geom, c.the_geom, 2414.016)<br>
<div><div></div><div>_______________________________________________<br>
postgis-users mailing list<br>
<a href="mailto:postgis-users@postgis.refractions.net" target="_blank">postgis-users@postgis.refractions.net</a><br>
<a href="http://postgis.refractions.net/mailman/listinfo/postgis-users" target="_blank">http://postgis.refractions.net/mailman/listinfo/postgis-users</a><br>
<br>
</div></div></blockquote></div><br></div></div></div>
</blockquote></div><br>