[R-sig-Geo] create an Hexagonal grid
Breitbach, Nils
breitbach at uni-mainz.de
Wed Sep 15 18:45:04 CEST 2010
Dear Gianni,
a good reference is the book "Applied Spatia lData Analysis with R", where there is an example in the Chapter "6.4 Hexagonal Grids" on page 137. Try this example using the test data set "meuse":
> library(sp)
> data(meuse.grid)
> HexPts <- spsample(meuse.grid, type = "hexagonal", cellsize = 200)
> spplot(meuse.grid["dist"], sp.layout = list("sp.points", HexPts, col = 1))
> HexPols <- HexPoints2SpatialPolygons(HexPts)
> df <- as.data.frame(meuse.grid)[overlay(meuse.grid, HexPts), ]
> HexPolsDf<-SpatialPolygonsDataFrame(HexPols, df, match.ID = FALSE)
> spplot(HexPolsDf["dist"])
More details in the above mentioned (very helpful) book. According to the book, there are no classes for hexagonal grids but some useful funtions to generate and plot them.
Good luck!
Nils
________________________________________
Von: r-sig-geo-bounces at stat.math.ethz.ch [r-sig-geo-bounces at stat.math.ethz.ch]" im Auftrag von "gianni lavaredo [gianni.lavaredo at gmail.com]
Gesendet: Mittwoch, 15. September 2010 17:29
Bis: r-sig-geo at stat.math.ethz.ch
Betreff: [R-sig-Geo] create an Hexagonal grid
Dear reseacher,
is there a way to create an Hexagonal grid with R?
thanks
Gianni
[[alternative HTML version deleted]]
_______________________________________________
R-sig-Geo mailing list
R-sig-Geo at stat.math.ethz.ch
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
More information about the R-sig-Geo
mailing list