[R-sig-Geo] [FORGED] spsample: defining the size of the cell in an hexagonal grid

Rolf Turner r.turner at auckland.ac.nz
Wed Mar 1 09:03:43 CET 2017


On 01/03/17 17:33, Manuel Spínola wrote:
> Dear list members,
>
> How can I define the size in hectares of the cell when doingan hexagonal
> grid with the function spsample.  What it means "cellsize"?  I want to
> create cell sizes according to some specific number of hectares.  How can I
> do it?
>
>
> data(meuse.grid)
> gridded(meuse.grid) = ~x+y
> plot(meuse.grid)
> HexPts <-spsample(meuse.grid, type="hexagonal", cellsize=1000)
> HexPols <- HexPoints2SpatialPolygons(HexPts)
> plot(HexPols[meuse.grid,], add=TRUE)


I have no knowledge of spsample() nor of its argument cellsize (doesn't 
the help for spsample() tell you what this argument means?) but it might 
be useful for you to realise (if you are not already aware of this) that 
the area of a regular hexagon is

     A = 3*sqrt(3)*s^2/2

where s is the length of side of the hexagon.  So if you want hexagons 
of area 42 hectares you would take their sides to be of length 402.0673 
metres.

cheers,

Rolf Turner

-- 
Technical Editor ANZJS
Department of Statistics
University of Auckland
Phone: +64-9-373-7599 ext. 88276



More information about the R-sig-Geo mailing list