Create and Save a Map of a Digital Elevation Model (DEM)
single_map.RdGenerates a plot of a DEM clipped to an Area of Interest (AOI) and saves it as a JPG file.
Examples
if (FALSE) { # \dontrun{
library(sf)
library(terra)
# Define a dummy area of interest
aoi <- st_as_sf(data.frame(
id = 1,
geometry = st_sfc(st_polygon(list(rbind(
c(77.0, 28.0), c(78.0, 28.0), c(78.0, 29.0), c(77.0, 29.0), c(77.0, 28.0)
))))
), crs = 4326)
# --- Example 1: Map with Simulated DEM ---
dem_fake <- rast(nrows = 100, ncols = 100, xmin = 76, xmax = 79, ymin = 27, ymax = 30, vals = runif(10000, 200, 800))
crs(dem_fake) <- "EPSG:4326"
single_map(
aoi = aoi,
dem = dem_fake,
output_file = "output/simulated_dem_map.jpg",
title = "Simulated Elevation"
)
} # }