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

Daniel Ceregatti vi at sh.nu
Fri Sep 12 11:09:27 PDT 2003

Sigh...I'm still having some trouble wrapping my mind around all this. I
followed the thread referenced in this post:


This post shows a "bastardized" query for doing what I need. Thing is,
it seems that there are some assumptions made. For example, the "Miles
per lat, Miles per lon" deal. Obviously this will vary over great
distances. As I want to be able to query distances around the entire
world, and across 90 lon/180 lat, I don't see how this will do what I need.

Hugh, perhaps you can tell me how you ultimately did this? My thread
starts here:



Daniel Ceregatti

Paul Ramsey wrote:

> 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.
> P

More information about the postgis-users mailing list