1

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.

2
  • If all else fails, would it work for you to have a DEM and a shapefile with county borders, such that you can calculate it yourself?
    – gerrit
    Commented Aug 20 at 6:57
  • That would be possible.
    – bill999
    Commented Aug 20 at 13:03

1 Answer 1

1

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)

elevation map of USA

You can use geodata::elevation_global() to get global coverage and extract data.

Created on 2024-08-28 with reprex v2.1.0

1
  • Nice, thanks! Good to know about geodata and this approach.
    – bill999
    Commented Aug 28 at 20:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.