[postgis-users] creating a spatial index for finding objects withing a certaindistance in miles based on lat/lon

Paul Ramsey pramsey at refractions.net
Fri Sep 12 10:21:44 PDT 2003

Daniel Ceregatti wrote:

>>Daniel, lat/lon *are* degrees. Degrees are the units of a lat/lon data
>>set. You can pretend that lat/lon coordinates are planar for the

> I'm not too "geometrically inclined", hence my confusion. So what you're
> saying is that my existing index is already appropriate for the query?

Yes, that is what I am saying. You just have to question your index in 
the right way. Instead of asking "what are all the points within 3 miles 
of point X?" you have to ask "what are all the points within a bounding 
box of (lon1 lat1,lon2 lat2) and also within 3 miles of point X?" So the 
only "tricky" bit is constructing the bounding box so that it is about 6 
miles on a side but expressed in degrees of latitude and longitude.


      | Paul Ramsey
      | Refractions Research
      | Email: pramsey at refractions.net
      | Phone: (250) 885-0632

More information about the postgis-users mailing list