Skip to content

Instantly share code, notes, and snippets.

@jscarto
Last active Jan 18, 2022
Embed
What would you like to do?
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

RobinKohrs commented Jan 18, 2022

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