hex_grid: Overlay grid on map

View source: R/hex_grid.R

hex_gridR Documentation

Overlay grid on map

Description

Overlays hexagonal grid cells of specified area onto equal area world map.

Usage

hex_grid(size)

Arguments

size

Integer specifying grid cell area (in square kilometers).

Details

World map projection is cylindrical equal area.

Value

sf object containing:

geometry

grid cell geometry

hex

hex number ID. Each grid cell has a unique number

size

the area (in sqauare kilometers) of each grid cell

Examples

library(fungarium)

#import world shape file
shp <- rnaturalearth::ne_countries('large', returnclass = "sf")

#transform to cylindrical projection (equal area)
shp <- sf::st_transform(shp, crs = "+proj=cea +ellps=WGS84 +datum=WGS84")

#get grid
grid <- hex_grid(80000)

hjsimpso/fungarium documentation built on Aug. 23, 2023, 3:59 p.m.