Learn R Programming

hexify (version 0.3.8)

hexify_grid_rect: Generate a rectangular grid of hexagon polygons

Description

Creates hexagon polygons covering a rectangular geographic region.

Usage

hexify_grid_rect(
  minlon,
  maxlon,
  minlat,
  maxlat,
  area,
  aperture = 3L,
  resround = "nearest"
)

Value

sf object with hexagon polygons covering the specified region

Arguments

minlon, maxlon

Longitude bounds

minlat, maxlat

Latitude bounds

area

Target cell area in km^2

aperture

Grid aperture: 3, 4, or 7

resround

Resolution rounding: "nearest", "up", or "down"

See Also

grid_rect for the recommended S4 interface, hexify_grid_global for global grids

Other sf conversion: hex_corners_to_sf(), hexify_cell_to_sf(), hexify_grid_global()

Examples

Run this code
library(hexify)
library(sf)

grid <- hexify_grid_rect(
  minlon = -10, maxlon = 20,
  minlat = 35, maxlat = 60,
  area = 5000
)
plot(st_geometry(grid), border = "gray")

Run the code above in your browser using DataLab