Skip to content

Instantly share code, notes, and snippets.

@jscarto
Last active January 18, 2022 16:55
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jscarto/6c0413f4820ed5141744e96e19f31205 to your computer and use it in GitHub Desktop.
Save jscarto/6c0413f4820ed5141744e96e19f31205 to your computer and use it in GitHub Desktop.
Export a single image from GIBBS tile server. // UNTESTED MAY NOT WORK
outformat=JPEG
category=best
layer=MODIS_Terra_CorrectedReflectance_TrueColor
caldate=2020-09-09
tileset=250m
ext=jpg
tilelevel=9
bands=3
tmp_image=output.jpg
cmd="gdal_translate -q -of "$outformat" -outsize 18000 9000 -projwin -180 90 180 -90 '<GDAL_WMS><Service name=\"TMS\"><ServerUrl>https://gibs.earthdata.nasa.gov/wmts/epsg4326/$category/"$layer"/default/"$caldate"/"$tileset"/\${z}/\${y}/\${x}."$ext"</ServerUrl></Service><DataWindow><UpperLeftX>-180.0</UpperLeftX><UpperLeftY>90</UpperLeftY><LowerRightX>396.0</LowerRightX><LowerRightY>-198</LowerRightY><TileLevel>"$tilelevel"</TileLevel><TileCountX>2</TileCountX><TileCountY>1</TileCountY><YOrigin>top</YOrigin></DataWindow><Projection>EPSG:4326</Projection><BlockSizeX>512</BlockSizeX><BlockSizeY>512</BlockSizeY><BandsCount>"$bands"</BandsCount></GDAL_WMS>' $tmp_image"
eval $cmd
echo 'all done!'
@RobinKohrs
Copy link

Is there any way to pass something like a bounding box to not query the entire earth?:)

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