[postgis-users] A 'radar' query

Tim Poh tim.poh at gmail.com
Mon Apr 4 06:40:31 PDT 2005


Hello,

I'm trying to do a query to find geometric objects within X km from a
point that could be anywhere in the world. I'm aware of the query in
chap3 of postgis documentation to find geometry objects around a
certain radius from a specific point.

SELECT * 
FROM GEOTABLE 
WHERE 
  GEOCOLUMN && Expand(GeomFromText('POINT(1000 1000)',-1),100)
AND
  Distance(GeomFromText('POINT(1000 1000)',-1),GEOCOLUMN) < 100;

However, since the SRID = -1, the 100 shown above is actually 100
units and it's not in unit of meters. If i were to continue using -1
as SRID, what formula or function do i use to convert actual values in
kilometers to the equivalent units above ? (Basically, is there a
distance_sphere'() ---> the inverse function of distance_sphere() ?)

I've looked thru all the documentation on SRID, reprojections,
distance_shperoid() etc. But i'm still unclear how to make use of SRID
so that the '100' above is actually 100 in meters. Can anyone shed
some light or direct me to any links that might be of help. I'm
postgis newbie, your help is much appreciated.

Regards,
Tim



More information about the postgis-users mailing list