Skip to content

Instantly share code, notes, and snippets.

@mdsumner
Last active March 25, 2025 15:32
Show Gist options
  • Save mdsumner/9ece1a80f10c911d80d47788b1ae67cd to your computer and use it in GitHub Desktop.
Save mdsumner/9ece1a80f10c911d80d47788b1ae67cd to your computer and use it in GitHub Desktop.

https://github.com/openlandmap/GEDTM30?tab=readme-ov-file

gdalinfo /vsicurl/https://s3.opengeohub.org/global/edtm/legendtm_rf_30m_m_s_20000101_20231231_go_epsg.4326_v20250130.tif

Driver: GTiff/GeoTIFF
Files: /vsicurl/https://s3.opengeohub.org/global/edtm/legendtm_rf_30m_m_s_20000101_20231231_go_epsg.4326_v20250130.tif
Size is 1440010, 600010
Coordinate System is:
GEOGCRS["WGS 84",
    ENSEMBLE["World Geodetic System 1984 ensemble",
        MEMBER["World Geodetic System 1984 (Transit)"],
        MEMBER["World Geodetic System 1984 (G730)"],
        MEMBER["World Geodetic System 1984 (G873)"],
        MEMBER["World Geodetic System 1984 (G1150)"],
        MEMBER["World Geodetic System 1984 (G1674)"],
        MEMBER["World Geodetic System 1984 (G1762)"],
        MEMBER["World Geodetic System 1984 (G2139)"],
        MEMBER["World Geodetic System 1984 (G2296)"],
        ELLIPSOID["WGS 84",6378137,298.257223563,
            LENGTHUNIT["metre",1]],
        ENSEMBLEACCURACY[2.0]],
    PRIMEM["Greenwich",0,
        ANGLEUNIT["degree",0.0174532925199433]],
    CS[ellipsoidal,2],
        AXIS["geodetic latitude (Lat)",north,
            ORDER[1],
            ANGLEUNIT["degree",0.0174532925199433]],
        AXIS["geodetic longitude (Lon)",east,
            ORDER[2],
            ANGLEUNIT["degree",0.0174532925199433]],
    USAGE[
        SCOPE["Horizontal component of 3D system."],
        AREA["World."],
        BBOX[-90,-180,90,180]],
    ID["EPSG",4326]]
Data axis to CRS axis mapping: 2,1
Origin = (-180.001249999999999,85.001249999999999)
Pixel Size = (0.000250000000000,-0.000250000000000)
Metadata:
  AREA_OR_POINT=Area
Image Structure Metadata:
  LAYOUT=COG
  COMPRESSION=DEFLATE
  INTERLEAVE=BAND
  PREDICTOR=2
Corner Coordinates:
Upper Left  (-180.0012500,  85.0012500) (180d 0' 4.50"W, 85d 0' 4.50"N)
Lower Left  (-180.0012500, -65.0012500) (180d 0' 4.50"W, 65d 0' 4.50"S)
Upper Right ( 180.0012500,  85.0012500) (180d 0' 4.50"E, 85d 0' 4.50"N)
Lower Right ( 180.0012500, -65.0012500) (180d 0' 4.50"E, 65d 0' 4.50"S)
Center      (  -0.0000000,  10.0000000) (  0d 0' 0.00"W, 10d 0' 0.00"N)
Band 1 Block=2048x2048 Type=Int32, ColorInterp=Gray
  NoData Value=-2147483648
  Overviews: 720005x300005, 360002x150002, 180001x75001, 90000x37500, 45000x18750, 22500x9375, 11250x4687, 5625x2343, 2812x1171, 1406x585
  Offset: 0,   Scale:0.1

Put any grid specification here in place of rast() for crop, resize, reproject or a combo thereof.

librayr(terra)
dsn <- "/vsicurl/https://s3.opengeohub.org/global/edtm/legendtm_rf_30m_m_s_20000101_20231231_go_epsg.4326_v20250130.tif"
r <- rast(dsn)
plot(project(r, > plot(project(r, rast(), by_util = TRUE))

Find out the size of the file (300Gb!!)

library(gdalraster)
vsi <- new(VSIFile, "/vsicurl/https://s3.opengeohub.org/global/edtm/legendtm_rf_30m_m_s_20000101_20231231_go_epsg.4326_v20250130.tif")
vsi$rewind()
vsi$seek(0, SEEK_END)
[1] 0
as.numeric(vsi$tell())/1e9
@mdsumner
Copy link
Author

image

@ctoney
Copy link

ctoney commented Mar 25, 2025

Find out the file size (simpler version):

library(gdalraster)
f <- "/vsicurl/https://s3.opengeohub.org/global/edtm/legendtm_rf_30m_m_s_20000101_20231231_go_epsg.4326_v20250130.tif"
vsi_stat(f, "size") / 1e9

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