[postgis-users] Algorithm for Overlaying Areas and Features
Paul Ramsey
pramsey at refractions.net
Fri Jul 8 16:58:23 PDT 2005
This is PostGIS land, so the answer looks like this (with variation
for whatever your column names are):
select count(*) as num_calls, zips.zipcode
from zips, calls
where
zips.the_geom && calls.the_geom
and
contains(zips.the_geom,calls.the_geom)
group by zipcode;
The answer is formulated differently for other tools, but as you
note, it is well understood and oft-repeated.
Paul
On 8-Jul-05, at 4:22 PM, Renato Salas wrote:
> Hi group:
>
> I'm curious about what is the underlying algorithm used to find out
> if a geo-feature is within an area.
>
> For instance, I have a dataset with emergency calls and another
> with zip areas. Then I want to know how many calls are in each area.
>
> I know I need to tag each feature with the zip area code it belongs
> to and then sum the number of calls for each area.
>
> My question is, how do I determine in which area a particular call
> belong in an efficiente manner. Do I have to step in each area to
> find which features are inside its boundaries?. Do I first need to
> sort the features by Lat/Lon so that I know the boundaries of my
> features, thus reducing the number of candidates areas?.
>
> I'm pretty sure this issue is well know and solved on the GIS
> community so please illuminate me since I don't want to reinvent
> the wheel.
>
> Thanks all in advance for your comments,
>
> Regards,
>
> Renato
> _______________________________________________
> 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