On Thu, 18 Mar 2010, [email protected] wrote:
Hi,
I have a Raster and converted to Polygons using pol<-rasterToPolygons(r2)
I have 1429 polygons and I would like to combine the attached polygon into
a bigger polygon. what should I do to create index to use
unionSpatialPolygons?
Create a vector (should be a factor) with the output unit IDs, as in ?by
(INDICES=) or ?aggregate (by=) in base R. unionSpatialPolygons() only
takes a single vector, so the extension to list arguments doesn't work (if
anyone needs it, use interaction() to create a single factor from more
than one). In your case either subset the polygons you wish to dissolve,
create the ID variable, dissolve, then add back to the dataset, or run the
operation on the whole data set, where union is a no-op for singleton IDs
(it only runs for ID counts > 1). Play with by() first to see how the
index works.
Roger
PS. An affiliation seems appropriate - is this for education, research,
what?
Thanks
Rajkumar
_______________________________________________
R-sig-Geo mailing list
[email protected]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
--
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: [email protected]
_______________________________________________
R-sig-Geo mailing list
[email protected]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo