I'm trying to download some VIIRS images from GIBS API. I'm using gdal:

gdal_translate -projwin 19.07 42.16 28.39 34.5 -of "GTiff" "viirs.xml" "VIIRS_SNPP_DayNightBand_ENCC.tif"

The viirs.xml file contains:

    <Service name="TMS"><ServerUrl>https://gibs.earthdata.nasa.gov/wmts/epsg4326/best/VIIRS_SNPP_DayNightBand_ENCC/default/2017-08-21/500m/${z}/${y}/${x}.png</ServerUrl>

But, it returns the following error:

Input file size is 131072, 655360
ERROR 1: GDALWMS: Incorrect bands count 1 in downloaded block, expected 4.
ERROR 1: GDALWMS: ReadBlockFromFile (https://gibs.earthdata.nasa.gov/wmts/epsg4326/best/VIIRS_SNPP_DayNightBand_ENCC/default/2017-08-21/500m/7/21/88.png) failed.
ERROR 1: viirs.xml, band 1: IReadBlock failed at X offset 88, Y offset 21
ERROR 1: GetBlockRef failed at X block offset 88, Y block offset 21

The error was originated from an old gdal version (2.1.2). It works with gdal 2.2.1!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.