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

Manuel Spínola mspinola10 at gmail.com
Sat Mar 4 15:10:06 CET 2017


Thank you very much to both.

Manuel

2017-03-04 6:35 GMT-06:00 Marcelino de la Cruz Rot <
marcelino.delacruz at urjc.es>:

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


-- 
*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