Skip to content

Instantly share code, notes, and snippets.

@mdsumner
Last active June 23, 2025 05:35
Show Gist options
  • Save mdsumner/c8ea591a43802f30490ddf5abc55f44d to your computer and use it in GitHub Desktop.
Save mdsumner/c8ea591a43802f30490ddf5abc55f44d to your computer and use it in GitHub Desktop.

code to do a small extract in R

https://rstats.me/@mdsumner/114729203537529604

Global Ensemble Digital Terrain Model 30m (GEDTM30)

https://zenodo.org/records/15490367

library(terra)
r <- terra::rast("/vsicurl/https://s3.opengeohub.org/global/edtm/legendtm_rf_30m_m_s_20000101_20231231_go_epsg.4326_v20250130.tif")
#class       : SpatRaster 
#dimensions  : 600010, 1440010, 1  (nrow, ncol, nlyr)
#resolution  : 0.00025, 0.00025  (x, y)
#extent      : -180.0012, 180.0012, -65.00125, 85.00125  (xmin, xmax, ymin, ymax)
#coord. ref. : lon/lat WGS 84 (EPSG:4326) 
#source      : legendtm_rf_30m_m_s_20000101_20231231_go_epsg.4326_v20250130.tif 
#name        : legendtm_rf_30m_m_s_20000101_20231231_go_epsg.4326_v20250130 

rr <- terra::rast(terra::ext(146, 147, -44, -43), res = .001, crs = "EPSG:4326")
rr <- project(r, rr, by_util = TRUE)
plot(rr)

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment