Dear all,
  Somebody has discussed the similar question before, "converting grid
objects to spatial polygon objects and export as shapefile (
https://stat.ethz.ch/pipermail/r-sig-geo/2009-December/007163.html)", where
they have successfully convert the grids into spatial polygons. But the
generated polygons didnot merge any original grids.
   Now, i have a grid dataset, its attribute is 0/1 variable. So finally i
hope to get two shape files, one is its attribute being 0, another
is attribute being 1. But particularly, i hope to merge the grids if their
attribute's values are same, so the final polygon maybe irregular,which is
different from the previous post. Note each shape files may have several
polygons after merging because the grids with same value are not all in the
similar positions. That means i only want to merge those close grids with
same value in adjacent positions, and not expect to generate a big polygon
with some holes in it.The main problem maybe how to merge those adjacent
grids with same values into polygons.
#Example data
gt <- GridTopology(c(0.05,0.05), c(0.1,0.1), c(10,10))
xv<-rnorm(length(coordinates(gt)[,1]))
xvs<-ifelse(xv>0.2,1,0)
grd <- SpatialGridDataFrame(gt,
data.frame(xvs),proj4string=CRS(as.character(NA)))
grdM<-as.matrix(data.frame(coordinates(grd),grd@data))
grdM[1:5,]
  Any ideas on this? I'd appreciate any suggestions or help.
  Thanks.

-- 
-----------------
Jane Chang
Queen's

	[[alternative HTML version deleted]]

