[postgis-users] Latitude and longitude distances

Ethan Alpert ealpert at digitalglobe.com
Wed Jul 27 08:42:02 PDT 2005



Well postgis really doesn't support this activity well. You can only
really compute linear distance using the distance_spheriod function but
the buffer function doesn't support using meters if the data is in a
geodetic coordinate system so that complicates the sql you need to
write.

You can do what you're after with distance_spheriod but you need to
compute the distance against every point unless you come up with a
scheme of querying. For instance you can perhaps select points that
intersect a box that has a +- some degree differnce and then compute the
distance of your query point against the results rather than the full
dataset. You'll have to be careful though if you have points at high and
low latitudes as this approach may not capture all points with in a
distance radius.

Anyhow long story short is you can do it in postgis but postgis doesn't
help you out too much with it's built in functions. You'll need to
understand more about coordinate systems, projections and datums to
really do this accurately and come up with efficient implementations.
Implementations could vary depending on the distrobution of your points
within the lat/lon coordinate system. If all your points say fall within
a UTM zone or a state plane coordinate system then you could get away
with just projecting all your data into the appropriate projection.

-e




-----Original Message-----
From: postgis-users-bounces at postgis.refractions.net
[mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of
Vacuum Joe
Sent: Tuesday, July 26, 2005 11:48 PM
To: postgis-users at postgis.refractions.net
Subject: [postgis-users] Latitude and longitude distances


Hello,

I'm new to PostGIS.  I have what I hope is a basic
question.  I have a database with many locations in
it.  These locations are all specified by latitude and longitude.  I
need to be able to do things like select all the rows that are within a
certain radius of a given latitude/longitude.  The results don't have to
be precise, and the radius will never be more than a few miles.

I assume this type of use is perfectly within what
PostGIS can do, but I can't figure out how to store
lon/lat data and do searches on it.

If there are any docs or examples you could point me
to, I would greatly appreciate it.

Thanks


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
_______________________________________________
postgis-users mailing list postgis-users at postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users



More information about the postgis-users mailing list