[R-sig-Geo] select polygons in polygons

Edzer Pebesma edzer.pebesma at uni-muenster.de
Thu Sep 25 17:06:34 CEST 2008


If you're thinking the PostGIS route, you might also want to look at 
read/writeOGR in package rgdal, which has a postgis driver.

There are some examples of this (for points) on 
http://wiki.intamap.org/index.php/PostGIS
--
Edzer

Murray Richardson wrote:
> Thanks Edzer - I looked into it but I need to coerce the SPDF objects 
> to gpc.poly objects and then I will lose all the attribute data I think.
> I may just have to use RODBC with postGIS to speed up the selection 
> process, which has worked well for me in other situations, but makes 
> the scripts that much more cumbersome.
>
> cheers
>
> Murray
>
> Edzer Pebesma wrote:
>> That's right, it is not there; I thought this morning about a way to 
>> look whether all the points of one polygon fall in another, which 
>> sp's overlay could do, but that's not a sufficient condition.
>>
>> Perhaps functions in package gpclib can do this?
>> -- 
>> Edzer
>>
>> Murray Richardson wrote:
>>> Thanks Friderike.  I assumed this was the answer, but it doesn't 
>>> appear to work with two SPDF objects.  i.e.:
>>>
>>> > overlay(polysA,polysB)
>>> Error in function (classes, fdef, mtable)  :
>>>  unable to find an inherited method for function "overlay", for 
>>> signature "SpatialPolygonsDataFrame", "SpatialPolygonsDataFrame"
>>>
>>>
>>> Murray
>>>
>>>
>>> Oehler, Friderike (AGPP) wrote:
>>>> Try ?overlay
>>>>
>>>> Regards,
>>>> Friderike
>>>>
>>>>
>>>> -----Original Message-----
>>>> From: r-sig-geo-bounces at stat.math.ethz.ch
>>>> [mailto:r-sig-geo-bounces at stat.math.ethz.ch] On Behalf Of Murray 
>>>> Richardson
>>>> Sent: 25 September 2008 06:01
>>>> To: r-sig-geo at stat.math.ethz.ch
>>>> Subject: [R-sig-Geo] select polygons in polygons
>>>>
>>>>
>>>> Hello users,
>>>>
>>>> There is probably a very simple solution to this that I am missing: 
>>>> is there a way to select polygons in one SPDF that fall within the 
>>>> polygons of another SPDF? This would save me a lot of processing 
>>>> time as I am having to take a very circuitous route to achieve the 
>>>> same outcome.
>>>>
>>>> Thanks!
>>>>
>>>> Murray
>>>>
>>>> _______________________________________________
>>>> R-sig-Geo mailing list
>>>> R-sig-Geo at stat.math.ethz.ch 
>>>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>>>
>>>>
>>>
>>> _______________________________________________
>>> R-sig-Geo mailing list
>>> R-sig-Geo at stat.math.ethz.ch
>>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>

-- 
Edzer Pebesma
Institute for Geoinformatics (ifgi), University of Münster,
Weseler Straße 253, 48151 Münster, Germany.  Phone: +49 251
8333081, Fax: +49 251 8339763  http://ifgi.uni-muenster.de/
http://www.springer.com/978-0-387-78170-9




More information about the R-sig-Geo mailing list