Site icon R-bloggers

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.

Porcupine River – public domain by David Spencer, FWS

Day 20 of 30DayMapChallenge: « Outdoors » (previously). Get some fresh air in Alaska!

< section id="setup" class="level2">

Setup

library(terra)
library(viridis)
< section id="data" class="level2">

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")
}
< section id="map" class="level2">

Map

rast(dtm_file) |> 
  crop(ext(572000, 582000, 7370000, 7380000)) |> 
  plot(col = rev(magma(256)), axes = FALSE, smooth = TRUE, legend = FALSE)
Figure 1: Yukon Flats. Data: USGS/Aero-Metric
< !-- -->
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.
Exit mobile version