Learn R Programming

lawn (version 0.1.7)

lawn_hex_grid: Create a HexGrid

Description

Takes a bounding box and a cell size in degrees and returns a data-FeatureCollection of flat-topped hexagons (data-Polygon features) aligned in an "odd-q" vertical grid as described in Hexagonal Grids http://www.redblobgames.com/grids/hexagons/

Usage

lawn_hex_grid(extent, cellWidth, units)

Arguments

extent
(numeric) extent in [minX, minY, maxX, maxY] order
cellWidth
(integer) width of each cell
units
(character) units to use for cellWidth, one of 'miles' or 'kilometers'

Value

data-FeatureCollection grid of points

See Also

Other interpolation: lawn_isolines, lawn_planepoint, lawn_point_grid, lawn_square_grid, lawn_tin, lawn_triangle_grid

Examples

Run this code
lawn_hex_grid(c(-96,31,-84,40), 50, 'miles')
lawn_hex_grid(c(-96,31,-84,40), 30, 'miles')

Run the code above in your browser using DataLab