[postgis-users] Finding points in a circle
Paragon Corporation
lr at pcorp.us
Tue Apr 14 01:25:14 PDT 2009
Tony,
Just to add to what everyone else has said.
Be careful with long lat data. Buffering in long lat does not produce a
circle since the distance would be in degree units and be applied using
planar geometry. You'll want to transform to planar like some UTM space.
Here is a response I gave to someone that asked me a similar question.
http://www.bostongis.com/blog/index.php?/archives/28-Using-generate_series-t
o-Generate-Test-Spatial-Data.html#c419
though new function page is (utmzone function is on this page that is
referred to above)
http://trac.osgeo.org/postgis/wiki/UsersWikiplpgsqlfunctions
(I guess we should break out all those functions)
Anyrate if all your data can fit in a UTM or some state plane you would be
advised to transform to that spatial ref before doing these calculations.
then you could just use ST_Dwithin. You don't necessarily need to store
your data in a planar projection, but you should have a functional index on
that projection.
For US data I like to use 2163 (for somewhat decent measurement -- its not
as good as state plane or utm but provides good enough measurement for my
wide ranging distance US calcs and covers all of continental US).
Hope that helps,
Regina
-----Original Message-----
From: postgis-users-bounces at postgis.refractions.net
[mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of Tony
Elmore
Sent: Tuesday, April 14, 2009 1:27 AM
To: postgis-users at postgis.refractions.net
Subject: [postgis-users] Finding points in a circle
Admittedly, I have not spent a tremendous amount of time with this yet
- so I'm not really asking for a solution here, but would like some feedback
to determine if I'm on the right track.
Is this scenario possible using postGIS?
i have many items (hundreds of thousands) with each item containing a lat /
lng and a radius (each item could have a different radius). The circle
created by the lat / lng and radius for each item would in all likelihood
overlap with other items.
Given a random point, is it possible to retrieve all of the rows where the
random point is inside the circle created from the lat / lng and radius?
I would assume I should create the circle for each item first and store that
as geometry.
Could someone please verify that this scenario is appropriate for postgis.
Regards,
Tony
_______________________________________________
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