Description Usage Arguments Details Value Author(s) See Also Examples
View source: R/create_fishnet.R
function to create a raster and/or polygon fishnet of specified resolution over a
raster dataset. By default, the fishnet is built so that each cell corresponds to a raster cell.
If the pix_for_cell
argument is set, then the polygons of the fishnet are built so to include
the specified number of cells in each direction. If the cellsize
option is set, a fishnet of the
specified resolution is created over the extent of the raster)
1 2 3 |
in_rast |
raster file or object of class |
pix_for_cell |
|
cellsize |
|
to_file |
PARAM_DESCRIPTION, Default: NULL |
out_shape |
PARAM_DESCRIPTION, Default: NULL |
overwrite |
PARAM_DESCRIPTION, Default: TRUE |
crop_layer |
(optional) object of class |
DETAILS
OUTPUT_DESCRIPTION
Lorenzo Busetto, PhD (2017) email: lbusett@gmail.com
extent
,res
st_as_sfc
,st_make_grid
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | ## Not run:
# create a fishnet over an input raster file and save it as a shapefile
library(raster)
library(sprawl)
library(rasterVis)
in_rast <- build_testraster(20,20,1)
fishnet <- create_fishnet(in_rast)
plot_rast(in_rast, in_poly = fishnet)
fishnet <- create_fishnet(in_rast, pix_for_cell = c(2,2))
plot_rast(in_rast, in_poly = fishnet)
fishnet <- create_fishnet(in_rast, cellsize = c(22,50))
plot_rast(in_rast, in_poly = fishnet)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.