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

Marcelino de la Cruz Rot marcelino.delacruz at urjc.es
Sat Mar 4 13:35:01 CET 2017


My apologies for such a pair (or more) of embarrassing mistakes!

I should read a bit more these days...


Marcelino



El 04/03/2017 a las 2:31, Rolf Turner escribió:
> On 04/03/17 08:38, Marcelino de la Cruz Rot wrote:
>> Hi  Manuel,
>>
>> I do answer to the question "How can I make a spatial grid of 1 ha (or
>> other size) in R?"
>>
>> You can use function hextess in spatstat
>>
>> library(spatstat)
>>
>> # some arbitrary area, with coordinates in hectometres
>>  W <- Window(chorley)
>>
>> # As Rolf said, hexagons of 1ha should have side of 402.0673 metres, so,
>> in hectometres:
>>
>> s <- 4.020673
>>
>> plot(hextess(W, s))
>> plot(hexgrid(W, s), add=TRUE)
>
> Marcelino,
>
> Actually I said hexagons of area *42* ha should have side length equal 
> to 402.0673 metres.
>
> Moreover the Chorley data set has units of *kilometres* not hectometres,
> so that should be s <- 0.4020673.  Or, to avoid just a touch of 
> round-off error, s <- sqrt(2*0.42)/3^0.75.
>
> Note that if you then do
>
> xxx <- hextess(W,s,trim=FALSE)
> unique(sapply(tiles(xxx),area.owin))
>
> you get 0.42 --- i.e. 0.42 square kilometres, or 42 hectares.
>
> cheers,
>
> Rolf
>


-- 
Marcelino de la Cruz Rot
Depto. de Biología y Geología
Física y Química Inorgánica
Universidad Rey Juan Carlos
Móstoles España



More information about the R-sig-Geo mailing list