library(tidyverse) library(terra) library(viridis)
Day 20 of 30DayMapChallenge: « Outdoors » (previously). Get some fresh air in Alaska!
library(tidyverse) library(terra) library(viridis)
You can browse several DEM datasets on https://elevation.alaska.gov/#66.53733:-145.25385:13. Yukon Flats by Lidar look promising…
dtm_file <- "yukon_flats_usgs_2pt5_dtm.tif" if (!file.exists(dtm_file)) { download.file("https://elevation.alaska.gov/download?geojson=%7B%22type%22%3A%22Polygon%22%2C%22coordinates%22%3A%5B%5B%5B-145.4186%2C66.5036%5D%2C%5B-145.4186%2C66.5710%5D%2C%5B-145.0891%2C66.5710%5D%2C%5B-145.0891%2C66.5036%5D%2C%5B-145.4186%2C66.5036%5D%5D%5D%7D&ids=134", "custom_download.zip") unzip("custom_download.zip") unzip("dds4/yukon_flats_usgs/dtm/yukon_flats_usgs_2pt5_dtm.zip") }
rast(dtm_file) |> crop(ext(572000, 582000, 7370000, 7380000)) |> plot(col = rev(magma(256)), axes = FALSE, smooth = TRUE, legend = FALSE)