[R-sig-Geo] Making an hexagonal grid using spsample

Manuel Spínola mspinola10 at gmail.com
Fri Mar 3 20:03:38 CET 2017


Dear list members,

I am trying to make an spatial hexagonal grid in R using the spsample
function. I would like hexagons of 1 ha = 10000 sq meters.


First I used a cell size of 62.04 m as the side of the hexagon.

data(meuse.grid)
gridded(meuse.grid) = ~x + y
proj4string(meuse.grid) <- CRS("+init=epsg:28992")
xx <- spsample(meuse.grid, type = "hexagonal", cellsize = 62.04)
xx <- HexPoints2SpatialPolygons(xx)
rgeos::gArea(xx, byid=TRUE)

It gave me an area per hexagon = 3333.299

Second I used a cell size of 62.04 * 2 = 124.08 m as the long diagonal of
the hexagon

data(meuse.grid)
gridded(meuse.grid) = ~x + y
proj4string(meuse.grid) <- CRS("+init=epsg:28992")
xx <- spsample(meuse.grid, type = "hexagonal", cellsize = 62.04*2)
xx <- HexPoints2SpatialPolygons(xx)
rgeos::gArea(xx, byid=TRUE)

It gave me an area per hexagon = 13333.19

Both results are wrong, because I was expecting close to 10000.

How can I make a spatial grid of 1 ha (or other size) in R?

Manuel

-- 
*Manuel Spínola, Ph.D.*
Instituto Internacional en Conservación y Manejo de Vida Silvestre
Universidad Nacional
Apartado 1350-3000
Heredia
COSTA RICA
mspinola at una.cr <mspinola at una.ac.cr>
mspinola10 at gmail.com
Teléfono: (506) 8706 - 4662
Personal website: Lobito de río <https://sites.google.com/site/lobitoderio/>
Institutional website: ICOMVIS <http://www.icomvis.una.ac.cr/>

	[[alternative HTML version deleted]]



More information about the R-sig-Geo mailing list