Changes between Initial Version and Version 1 of UsersWikiplpgsqlfunctionsDistance
- Timestamp:
- 09/29/09 21:16:52 (15 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
UsersWikiplpgsqlfunctionsDistance
v1 v1 1 2 {{{ 3 -- 4 -- ST_DWithin_Sphere(lonlat-point, lonlat-point, radius-in-meters) returns boolean 5 -- 6 -- Meters/Degree @ 60N: select 1/distance_sphere('POINT(0 7 60)','POINT(1 60)') = 1.79866403673916e-05 8 -- 9 CREATE OR REPLACE FUNCTION ST_DWithin_Sphere(geometry, geometry, float8) 10 RETURNS boolean 11 AS 'SELECT $1 && ST_Expand($2,$3 * 1.79866403673916e-05) AND 12 $2 && ST_Expand($1,$3 * 1.79866403673916e-05) AND ST_Distance_Sphere($1, $2) < $3' 13 LANGUAGE 'SQL' IMMUTABLE; 14 15 16 }}}