MAPI_GridHexagonal {mapi}R Documentation

Function MAPI_GridHexagonal

Description

Build a grid of hexagonal cells according to samples coordinates and a given halfwidth cell value provided by users (can be computed using MAPI_EstimateHalfwidth).

Usage

MAPI_GridHexagonal(samples, crs, hw, buf = 0)

Arguments

samples

a data.frame with names and geographical coordinates of samples. Column names must be: 'ind', 'x', 'y'. Optional column 'errRad' with an error radius for sample locations (eg. GPS uncertainty). Coordinates must be projected (not latitude/longitude).

crs

coordinate reference system: integer with the EPSG code, or character with proj4string. When using dummy coordinates (eg. simulation output) you may use EPSG:3857 for example. This allows computation but, of course, has no geographical meaning.

hw

Halfwidth : side length of hexagonal cells.

buf

optional. This parameter allows to expand or shrink the grid by a number of units in the same reference system as the sample geographical coordinates (0 by default).

Value

a spatial object of class 'sf' including the x and y coordinates of cell centers, cell geometry (polygons) and cell id (gid).

Examples

data("samples")
# Builds a grid of hexagonal cells according to samples coordinates (columns x and y) 
# using the EPSG:3857 projection and an halfwidth cell value of hw=250m.
grid <- MAPI_GridHexagonal(samples, crs=3857, hw=250)


[Package mapi version 1.0.5 Index]