Outdoors
[This article was first published on r.iresmi.net, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
Day 20 of 30DayMapChallenge: « Outdoors » (previously). Get some fresh air in Alaska!
Setup
library(terra) library(viridis)
Data
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") }
Map
rast(dtm_file) |> crop(ext(572000, 582000, 7370000, 7380000)) |> plot(col = rev(magma(256)), axes = FALSE, smooth = TRUE, legend = FALSE)
To leave a comment for the author, please follow the link and comment on their blog: r.iresmi.net.
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.