View source: R/rasterize_vector.R
rasterize_vector | R Documentation |
Converts vector object to a raster with specified extent and resolution.
rasterize_vector( vector_data, outfile, template_raster, extent, res, crs, field, burn_value, datatype = "Float32", overwrite = FALSE, return_rast = FALSE )
vector_data |
Character. File path to vector spatial data. |
outfile |
Raster output file path. Parent directory will be created recursively if required. |
template_raster |
Optional. |
extent |
Either a character path to a raster file, an Extent object (or an object from which such an extent can be extracted), or a numeric vector with four elements giving xmin, xmax, ymin, ymax. |
res |
Numeric or integer vector giving the horizontal and vertical
spatial resolution of the target raster, in units of |
crs |
Target coordinate reference system as a PROJ string (character)
an object of class CRS. If missing and |
field |
Character. Name of attribute to be burned into raster. |
burn_value |
Numeric. A constant value to burn into raster. |
datatype |
Character. Output data type (see [gdal_rasterize(https://gdal.org/programs/gdal_rasterize.html) documentation). |
overwrite |
Logical. Should outfile be overwritten if it exists? |
return_rast |
Logical. Return object to R? |
A binarized raster is written to outfile
, and returned to R
as a RasterLayer
if return_rast
is TRUE
.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.