Where can I find minimum and maximum elevation data for US counties?
It would be a bonus if I could directly access it from within R, but other solutions are also good.
Where can I find minimum and maximum elevation data for US counties?
It would be a bonus if I could directly access it from within R, but other solutions are also good.
Use {geodata} package for elevation and boundaries, then use terra::zonal
or terra::extract
to get the min/max values, like:
elev <- geodata::elevation_30s("USA", path = "data")
usa <- geodata::gadm("USA", path = "data")
usa$NAME_1 |>
as.data.frame() |>
dplyr::mutate(max = terra::zonal(elev, usa, fun = "max", na.rm = TRUE))
#> usa$NAME_1 USA_elv_msk
#> 1 Alabama 689
#> 2 Alaska NaN
#> 3 Arizona 3709
[...]
#> 51 Wyoming 4032
There are missing values for Alaska and Hawaii because USA in elevation_30s
data set is filtered to mainland:
terra::plot(elev)
You can use geodata::elevation_global()
to get global coverage and extract data.
Created on 2024-08-28 with reprex v2.1.0