1

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.

enter image description here

2

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)])

discretized polygonized volcano

2

have a look at the examples in sp:

library(sp)
example(aggregate)

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.