[postgis-users] spheroid bounding box calculation

Stephen Frost sfrost at snowman.net
Thu Jul 23 04:06:16 PDT 2009


Jeff,

* Jeff Davis (pgsql at j-davis.com) wrote:
> I would like to query my latitude/longitude points  for distance in a
> way that uses the index. The points are in lat/lon, so st_dwithin(g1,
> g2, [meters]) makes no sense.
> 
> What is the recommended way to do this? I think what I need is a
> function that takes a point in lat/lon, and a distance in meters, and
> returns a bounding box in lat/lon.
> 
> Basically, I think it would be a variant of ST_Expand, but it could take
> an argument in meters rather than degrees. It may need a 'SPHEROID[]'
> argument, too, perhaps.

Why do you care about it being in meters..?  Just make sure that
st_expand will grow it large enough to be within the distance limit
you're looking for everywhere, and then convert to UTM for the actual
source point and use distance() there to further refine the search.

Use the bounding box to narrow the search, don't try to use it *as* your
search criteria.

	Thanks,

		Stephen
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20090723/bebc6ff9/attachment.pgp>


More information about the postgis-users mailing list