View source: R/rasterise_landuse.R
rasterise_landuse | R Documentation |
Rasterise land use zones (sf_landuse
) with reference to population data (sf_pop
), if supplied.
Multiple (a list of) output rasters will be generated if land use data for multiple years are present.
If the land use data includes unnecessary land use classes, the argument subset
and landuse
allows the user to first subset the data to polygons defined as 'residential' land use.
rasterise_landuse(
sf_landuse,
subset = NULL,
land_use = NULL,
year = "year",
sf_pop = NULL,
match_landuse_pop = "recent",
dir_rastertemplate = NULL,
dir_processing = tempdir(),
dir_export = tempdir(),
overwrite = TRUE,
wopt = list(gdal = c("COMPRESS=LZW")),
...
)
sf_landuse |
|
subset |
Named vector containing the residential land use classes of interest to retain in column |
land_use |
character. Specify column name of the land use classes. |
year |
character. Specify column name for the year within |
sf_pop |
(optional) |
match_landuse_pop |
character. Type of matching between |
dir_rastertemplate |
character. Filepath to the raster used to define the pixel resolution, extent, nrow, ncol of
the output raster; object is passed to the ' |
dir_processing |
character. Directory to get intermediate files generated in previous steps (e.g. rasterised population data).
Defaults to |
dir_export |
character. File path to directory to export output raster(s) to. Defaults to |
overwrite |
logical. Argument passed to |
wopt |
list. Argument passed to |
... |
Other arguments passed to |
If population data (sf_pop
) is supplied, its raster(s) must have been previously generated in the tempdir()
using
the function rasterise_pop()
. Each year in the population data is matched to a specific year in the land use data
(using the helper function matchyear()
). Land use raster(s) will then
be associated with a specific population census year, and removed if there are no matching population census years.
Rasterised land use zones will be masked away (i.e., convert pixels to NA
)
at areas with no (zero) population data (for the respective matching year).
List of raster files. Zero values are converted to NA
.
Each raster is also an intermediate file exported to the directory as defined by dir_export
(defaults to tempdir()
) for further processing.
## Not run:
data(pop_sgp)
data(landuse_sgp)
# transform to projected crs
pop_sgp <- sf::st_transform(pop_sgp, sf::st_crs(32648))
landuse_sgp <- sf::st_transform(landuse_sgp, sf::st_crs(32648))
# run function
landuse_rasters <- rasterise_landuse(landuse_sgp,
land_use = 'lu_desc',
subset = c('1' = 'RESIDENTIAL',
'2' = 'COMMERCIAL & RESIDENTIAL',
'3' = 'RESIDENTIAL WITH COMMERCIAL AT 1ST STOREY',
'4' = 'RESIDENTIAL / INSTITUTION'),
year = 'year',
sf_pop = pop_sgp,
match_landuse_pop = 'recent')
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.