importMap | R Documentation |
Import a raster for a specific region from a multisource environment, such as the outputs of the getMap function.
importMap(
region,
polys,
tile_id = "TILEID",
z_fix = NULL,
neighbor_distance = 5,
FUN = NULL,
mask = FALSE,
vals = "location",
filt = 0,
z_min = NULL,
dir = tempdir(),
...
)
region |
A SpatRaster, Raster*, SpatVector, Spatial* or character string representing the area of interest |
polys |
A polygon of class SpatVector representing the partitioning grid
for the maximum possible area, in the same format as the output of the
|
tile_id |
A character string representing the name of the column in the
|
z_fix |
A SpatRaster or Raster* object with the desired output projection,
resolution, and origin. Required if |
neighbor_distance |
An integer representing the number of cells that
tiles are buffered. In other words, to ensure that there are no gaps between tiles,
neighboring tiles within |
FUN |
Function to deal with overlapping values for overlapping tiles.
Default is |
mask |
If |
vals |
A character string or a Raster* object. Required only if the
|
filt |
Numeric. Size of moving window to apply a low-pass filter. Default
is |
z_min |
The minimum allowable elevation. Useful if DEM source includes
ocean bathymetry as does the SRTM data from AWS. Default is |
dir |
A filepath to the directory being used as the workspace. Default
is |
... |
Additional agruments to pass to |
# Generate a DEM, export it
n <- 5
dem <- expand.grid(list(x = 1:(n * 100),
y = 1:(n * 100))) / 100
dem <- as.data.table(dem)
dem[, z := 250 * exp(-(x - n/2)^2) +
250 * exp(-(y - n/2)^2)]
dem <- rast(dem)
ext(dem) <- c(10000, 20000, 30000, 40000)
crs(dem) <- "+proj=lcc +lat_1=48 +lat_2=33 +lon_0=-100 +datum=WGS84"
dir <- tempdir()
writeRaster(dem, paste0(dir,"/DEM.tif"),overwrite=TRUE)
# Import raster, get the grid
dem <- rast(paste0(dir,"/DEM.tif"))
grid <- makeGrid(dem = dem, nx = n, ny = n, sources = TRUE)
# Import the map for the center tile resampled to a different resolution
dem2 <- importMap('SECTOR_13', grid, res = 20)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.