Skip to content

Instantly share code, notes, and snippets.

@h-a-graham
Created May 8, 2022 21:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save h-a-graham/72aba85c4b30627071f05e8826d66edd to your computer and use it in GitHub Desktop.
Save h-a-graham/72aba85c4b30627071f05e8826d66edd to your computer and use it in GitHub Desktop.
An example of how to directly warp a geoid model into R.
# Warp and plot the EGM2008 1' geoid model
# geoid COGS hosted here: https://www.agisoft.com/downloads/geoids/
library(vapour)
library(gdalio)
library(terra)
source(system.file("raster_format/raster_format.codeR", package = "gdalio", mustWork = TRUE))
geoid <- '/vsicurl/https://s3-eu-west-1.amazonaws.com/download.agisoft.com/gtg/us_nga_egm2008_1.tif'
ri <- vapour_raster_info(geoid)
gdalio_set_default_grid(extent=ri$extent,
dimension = ri$dimXY,
projection = ri$projection)
geoid_ras <- gdalio_terra(geoid)
plot(geoid_ras, col=scico::scico(255), axes=FALSE)
@h-a-graham
Copy link
Author

image

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