[R-sig-Geo] Keep attributes of spdf - gIntersection, gSymdifference, gUnion
Roger Bivand
Roger.Bivand at nhh.no
Tue Aug 20 20:20:37 CEST 2013
On Tue, 20 Aug 2013, Alexandre Camargo Martensen wrote:
> Dear all,
>
> I have two SpatialPolygonsDataFrame and I am conducting some spatial
> operations such as gIntersection, gSymdifference, gUnion in rgeos. However,
> the outputs are SpatialPolygons, and thus, I lose the attributes (@data) of
> the original polygons.
>
> I need to keep the original attributes associated with the resulted
> attributes, and I was wondering if this is somehow possible, and how. I
> tried byid T and F without success.
While you may know which ID values are appropriate, the rgeos functions
cannot guess what you mean. Look at row.names() of the output objects, and
match substrings of those to the row.names() values of your input objects.
Hope this clarifies,
Roger
PS. Please do not post HTML.
>
> Thanks in advance.
>
> Alex
>
> [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
--
Roger Bivand
Department of Economics, NHH Norwegian School of Economics,
Helleveien 30, N-5045 Bergen, Norway.
voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no
More information about the R-sig-Geo
mailing list