Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace the MODIS Rapid Response handler with Worldview/GIBS #6

Open
raymondben opened this issue Jan 29, 2018 · 2 comments
Open

Replace the MODIS Rapid Response handler with Worldview/GIBS #6

raymondben opened this issue Jan 29, 2018 · 2 comments

Comments

@raymondben
Copy link
Member

Moved from ropensci/bowerbird#1

See https://earthdata.nasa.gov/earth-observation-data/near-real-time/rapid-response and earthdata.nasa.gov/about/science-system-description/eosdis-components/global-imagery-browse-services-gibs

@raymondben
Copy link
Member Author

Just a note for future reference: the WMS endpoint can be something like http://gibs.earthdata.nasa.gov/wms/epsg3031/best/wms.cgi?SERVICE=WMS&REQUEST=GetMap&VERSION=1.3.0&LAYERS=MODIS_Terra_CorrectedReflectance_TrueColor&STYLES=&FORMAT=image%2Fpng&TRANSPARENT=false&CRS=EPSG:3031&HEIGHT=1024&WIDTH=1024&BBOX=-4194304,-4194304,4194304,4194304&TIME=2018-12-01

@mdsumner
Copy link
Member

mdsumner commented Oct 25, 2021

we can do this with vapour/gdalio

 library(gdalio)  #remotes::install_github("hypertidy/gdalio")

sdsnames <- 
  vapour::vapour_sds_names("https://gibs.earthdata.nasa.gov/wms/epsg3031/best/wms.cgi?SERVICE=WMS&REQUEST=GetMap&VERSION=1.3.0&LAYERS=MODIS_Terra_CorrectedReflectance_TrueColor&STYLES=&FORMAT=image%2Fpng&TRANSPARENT=false&CRS=EPSG:3031&HEIGHT=1024&WIDTH=1024&BBOX=-4194304,-4194304,4194304,4194304&TIME=2021-10-25")


source(system.file("raster_format/raster_format.codeR", package = "gdalio", mustWork = TRUE))

## choose the output structure 

## 1. some other grid
template <- raster::raster(raadtools::readice())
gdalio_set_default_grid(template)
x1 <- gdalio_raster(sdsnames$subdataset[1L], bands = 1:3)
raster::plotRGB(x1)

## 2. native (there are various zoom levels)
ri <- vapour::vapour_raster_info(sdsnames$subdataset[1])
dims <- matrix(ri$overviews, nrow = 2)
gdalio_set_default_grid(list(extent = ri$extent, dimension = dims[,ncol(dims)-1], projection = ri$projection))

x2 <- gdalio_raster(sdsnames$subdataset[1L], bands = 1:3)
raster::plotRGB(x2)

## longlat
gdalio_set_default_grid(list(extent = c(-180, 180, -90, -40), dimension = c(1024, 684), projection = "OGC:CRS84"))

x3 <- gdalio_raster(sdsnames$subdataset[1L], bands = 1:3)
raster::plotRGB(x3)

Created on 2021-10-25 by the reprex package (v2.0.1)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants