[R-sig-Geo] Singlepart to multipart

Roger Bivand Roger.Bivand at nhh.no
Tue Oct 29 20:32:22 CET 2013


On Tue, 29 Oct 2013, Jonathan Greenberg wrote:

> R-sig-geo'ers:
>
> If I have a SpatialPolygonsDataFrame with a field "MYID", how do I go about
> coercing that object to a multipart polygon, where I am "merging" on the
> MYID field?

maptools::unionSpatialPolygons() which calls rgeos::gUnaryUnion, so go to 
rgeos::gUnaryUnion first unless you have challenged geometries - if hole 
problems use maptools::checkPolygonsHoles first.

Hope this helps,

Roger

>
> --j
>
>

-- 
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