
Make a grid over the bounding box of a location
Source:R/make_location_grid.R
make_location_grid.RdIf location is a single feature sf object, the original columns of the object are included in the output grid. If location has mutiple features, the values of name_col are combined with sfext::st_union_ext and other columns are dropped. The input sf object should not have columns named id, rows, or cols.
Arguments
- location
A sf, sfc, or bbox object passed to sfext::st_make_grid_ext
- name_col
Column name to collapse into new name_col value, Default: 'name'
- unit
Units for buffer. Supported options include "meter", "foot", "kilometer", and "mile", "nautical mile" Common abbreviations (e.g. "km" instead of "kilometer") are also supported. Distance in units is converted to units matching GDAL units for x; defaults to "meter"
- ...
Arguments passed on to
sfext::st_make_grid_extxA
sf,sfc, orbboxobject, Default:NULL. Required.crsCoordinate reference system of bounding box to return; defaults to
NULLwhich maintains the crs of the input object.ncol,nrowUsed to set n if either are not
NULL; defaults toNULL. row and id are added as columns to the grid if they are provided.nIf n is NULL and square is
TRUE, the grid is set automatically to be 10 cells wide, Default:NULLgutterDistance in units between each column cell; gutter effectively serves as a margin as the negative buffer is applied to all cells (including those at the edges of the grid).
descIf TRUE, reverse standard order of cell id numbering; defaults
FALSEcellsizenumeric of length 1 or 2 with target cellsize: for square or rectangular cells the width and height, for hexagonal cells the distance between opposite edges (edge length is cellsize/sqrt(3)). A length units object can be passed, or an area unit object with area size of the square or hexagonal cell.
what"polygons", "corners", "centers"; set to centers automatically if style is "circle", "circle_offset" but a buffer is applied to return circular polygons.
styleStyle of cell to return with options including "rect", "square", "hex", "flat_top_hex", "circle", "circle_offset"
.idA name to use for the cell id column. Defaults to "id".
filterIf
TRUE(or if trim isTRUE) filter grid geometry by x using st_filter_exttrimIf
TRUE, x is trimmed to y withst_trim().