gengrid2 | R Documentation |
This function takes in only a shapefile and creates a square or hexagon polygon grid based on a specified grid size
gengrid2( shp_dt = NULL, shp_dsn, shp_layer, grid_size, sqr = TRUE, pop_raster, raster_path = NULL, extract_name, raster_function = "sum" )
shp_dt |
an object of class 'sf' or 'sfc' |
shp_dsn |
character; the local directory folder in which the shapefile is location. Must be specified when shp_dt is not specified. |
shp_layer |
character; the layer name for the shapefile. Must be specified with shp_dsn when shp_dt is not specified |
grid_size |
numeric of length 1; representing the desired size of the grid in meters |
sqr |
logical; if TRUE, a square grid is created. If FALSE, a hexagonal polygon grid is created |
pop_raster |
raster; an object of class 'raster' |
raster_path |
character; if pop_raster is not specified but raster is to read in from file. raster_path is the full name of the raster (including filepath) |
extract_name |
character of length 1; the name of the indicator to be extracted from the raster |
raster_function |
function to be applied in extracting raster into created grids |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.