[postgis-users] Algorithm for Overlaying Areas and Features

Renato F. Salas rsalas at voxiva.net
Fri Jul 8 17:39:39 PDT 2005


Hi Paul:

Thank you very much for your comment.

I'm very new to PostGIS and basically I don't have this information 
stored as postgis tables but as simple points and paths on svg files 
(xml structured), so I will need to manually do the algorithms to find 
what is inside.

Could you please explain me what this do internally?.

Why there is a need to do: zips.the_geom && calls.the_geom
How the contains() function work?

If you have reference such as books or articles about the theory behind 
this it would be excellent.

Thank you very much for your reply.

Renato


Paul Ramsey wrote:

> 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