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

Norman Vine nhv at cape.com
Fri Sep 12 12:26:38 PDT 2003

Daniel Ceregatti writes:
> Unfortunately I can't narrow my search area down to such a small area.
> Ultimately I want to have the entire world be searchable via this facility.
> It seems that I simply need to incorporate the "degrees per distance
> unit" in the query that creates the box3d dynamically. Perhaps all
> that's needed now is to work out the math and test it.
> Oh, and figure out how to get around boxes that traverse 90 degree
> latitudes and  0/180 degree longitudes.

The general solution for what you are asking for is a fairly tough thing 
todo given a 2D world representation. 
i.e.  latitude longitude or 'planar' projection of same

It is not open source but the Hipparchus library which is built on the
3D direction cosine form of latitude longitude excels at this kind of thing
see http://www.geodyssey.com



More information about the postgis-users mailing list