Dear all; I have been working within R for performing the GIS-like operations with shapefiles. My goal is to overlay two spatial polygon data frames so I can add info from one of them to the other. I've tried severals option such as converting one of them to a spatial polygon object (without the associated info) in order to use the 'over' function from the maptools library. I have also tried the PBSmapping library and the aggregate function from maptools without success so far. Is there any way to perform this type of operation in R like in ArcGIS? I would appreciate any hint. Thanks in advance SW
intersection of two SpatialPolygonsDataFrame
2 messages · steven wilson, Barry Rowlingson
On Wed, Nov 16, 2011 at 3:32 AM, steven wilson <swpt07 at gmail.com> wrote:
Dear all; I have been working within R for performing the GIS-like operations with shapefiles. My goal is to overlay two spatial polygon data frames so I can add info from one of them to the other. I've tried severals option such as converting one of them to a spatial polygon object (without the associated info) in order to use the 'over' function from the maptools library. I have also tried the PBSmapping library and the aggregate function from maptools without success so far. Is there any way to perform this type of operation in R like in ArcGIS? I would appreciate any hint.
Have you tried the rgeos package? It has (probably) all the spatial overlay, buffering, merge/union/diff etc operations that you might ever need! What, more precisely, is your problem? I can only guess that you've got two spatial polygons data frames which have the same geometry but different attributes, but the polygons are in a different order and there's no ID variable to link them? If the geometries aren't the same then the operation is a bit trickier since you have to deal with overlaps, and then decide how the attributes from each layer end up in the result... Barry