Singlepart to multipart
Jonathan, You can go back and forth with (raster/sp) functions aggregate and disaggregate Robert
On Tue, Apr 1, 2014 at 7:50 AM, Jonathan Greenberg <jgrn at illinois.edu> wrote:
This is a counter-question to the previous one: how would I go about taking a multipart SpatialPolygon* and "flattening" it so each individual polygon is its own component, "repeating" the data frame (if a SpatialPolygonsDataFrame) for the new polygons, effectively "undoing" the previous suggestion? --j On Tue, Oct 29, 2013 at 2:32 PM, Roger Bivand <Roger.Bivand at nhh.no> wrote:
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
-- Jonathan A. Greenberg, PhD Assistant Professor Global Environmental Analysis and Remote Sensing (GEARS) Laboratory Department of Geography and Geographic Information Science University of Illinois at Urbana-Champaign 259 Computing Applications Building, MC-150 605 East Springfield Avenue Champaign, IL 61820-6371 Phone: 217-300-1924 http://www.geog.illinois.edu/~jgrn/ AIM: jgrn307, MSN: jgrn307 at hotmail.com, Gchat: jgrn307, Skype: jgrn3007
_______________________________________________ R-sig-Geo mailing list R-sig-Geo at r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo