[R-sig-Geo] Intended usage of gIntersection ?

Bernd Vogelgesang bernd.vogelgesang at gmx.de
Sat Sep 13 21:58:59 CEST 2014


Hi Robert,

GREAT! It works!
I think you saved my week(end).
Would have never guessed that the raster package will do such things, so I  
completely avoided to search in such a direction.

Maybe I will learn to do the trick with gIntersection one day, but for  
today, I'm on the winner street again with raster intersect, Crazy!

Cheers
Bernd

Am 13.09.2014, 19:44 Uhr, schrieb Robert J. Hijmans <r.hijmans at gmail.com>:

> The raster package has a few functions that extend rgeos by also
> attempting to handle attribute data as well. In this case, see
> raster::intersect
> And the list of functions here:
> ?"raster-package"
> (section XIV)
>
> Robert
>
> On Sat, Sep 13, 2014 at 10:04 AM, Bernd Vogelgesang
> <bernd.vogelgesang at gmx.de> wrote:
>> Dear list,
>>
>> I'm trying to intersect two SpatialPolygonsDataFrames imported from  
>> shape
>> files. (readOGR)
>> The idea is to get the new polygons + the merged attributes of both  
>> layers,
>> but the outcome is a SpatialPolygon class without a data slot.
>>
>> Is this the intended behaviour of gIntersection or is there something  
>> broken
>> in my R-Installation, cause I googled now for 2 days to find a solution  
>> on
>> that problem, but only found two hits on stackexchange where people had
>> similar problems, and no working solution (at least for me), nor was I  
>> able
>> to find any standard recipt how to join the attributes back to the new
>> polygons.
>>
>> So obviously only rare people seem to have the need to get also the data
>> from an intersection or do I miss some really basic R-capabilities not  
>> worth
>> to write down in any documentation??
>>
>> Hope someone can shed some light
>> Thanks
>> Bernd
>>
>> --
>> Bernd Vogelgesang
>> Siedlerstraße 2
>> 91083 Baiersdorf/Igelsdorf
>> Tel: 09133-825374
>>
>> _______________________________________________
>> R-sig-Geo mailing list
>> R-sig-Geo at r-project.org
>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo


-- 
Bernd Vogelgesang
Siedlerstraße 2
91083 Baiersdorf/Igelsdorf
Tel: 09133-825374



More information about the R-sig-Geo mailing list