Skip to content

Convert grids with 0/1 attribute to polygons with neighbor grids of same values merged

2 messages · zhijie zhang, Roger Bivand

#
On Thu, 28 Jan 2010, zhijie zhang wrote:

            
Almost there - you needed:

spol1 <- unionSpatialPolygons(as(spol, "SpatialPolygons"),
   as.character(spol$xvs))

image(grd, axes=TRUE)
plot(spol1, add=TRUE)

to complete, then I guess promotion back to a SpatialPolygonsDataFrame, 
then writing out for each type separately to shapefile.

Roger