Is it possible to convert SpatialPointDataFrame to SpatialPolygonDataFrame by some kind of generalization or aggregation function in R.
how can i form polygons from points of similar color/classified attribute value as show in picture.
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It only takes a minute to sign up.Sign up to join this community
Do it via
raster, as long as your points really are regular and the values are discrete (for dissolve) this should work:
library(raster) ## x is the SpatialPointsDataFrame r <- rasterFromXYZ(x) ## create polygons on unique values p <- rasterToPolygons(r, dissolve = TRUE)
Here's an example
library(raster) x <- as(raster(volcano%/% 10) * 10, "SpatialPointsDataFrame") r <- rasterFromXYZ(x) ## create polygons on unique values p <- rasterToPolygons(r, dissolve = TRUE) plot(p, col = topo.colors(nrow(p))[factor(p$layer)])