Re: [postgis-users] distance_spheroid and index files

wanxiangqian at 163.com wanxiangqian at 163.com
Fri Feb 25 23:26:02 PST 2005


Hi,

1 Extract the x,y (longitude,latitude) from the point geometry into two fields of places.

2 Use normal index to implement fast query.

The latitude optimization may be easy.

geom = point_of('berlin');
x0 = X(geom);
y0 = Y(geom);
rl = range_of_longitude(x0,10km);
rt = range_of_latitude(10km);
select * from places where x > x0 - rt and x < x0 + rt and y > y0 - rl and y < y0 + rl and distance_spheroid(
         location_geom,
         (select location_geom from places where place = 'Berlin'),
         'SPHEROID["WGS 84",6378137,298.257223563]'
     )/1000 < 10;

Wish you good luck!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20050226/c75eac5e/attachment.html>


More information about the postgis-users mailing list