fasterize2 | R Documentation |
A simple wrapper around terra::rasterize()
.
fasterize2(emptyRaster, polygonToFasterize, field)
emptyRaster |
An empty |
polygonToFasterize |
an |
field |
character or numeric. If |
an object of the same class as emptyRaster
## using sf + raster
f1 <- system.file("external/lux.shp", package = "raster")
v1 <- sf::st_read(f1)
r1 <- raster::raster(v1, ncols = 75, nrows = 100)
raster::crs(r1) <- "epsg:4326"
z1 <- fasterize2(r1, v1, "NAME_2")
## using terra
f2 <- system.file("ex/lux.shp", package = "terra")
v2 <- terra::vect(f2)
r2 <- terra::rast(v2, ncols = 75, nrows = 100)
z2 <- fasterize2(r2, v2, "NAME_2")
terra::compareGeom(terra::rast(z1), z2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.