0

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:

<GDAL_WMS>
    <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>
    </Service>
    <DataWindow>
        <UpperLeftX>-180.0</UpperLeftX>
        <UpperLeftY>90</UpperLeftY>
        <LowerRightX>396.0</LowerRightX>
        <LowerRightY>-198</LowerRightY>
        <TileLevel>7</TileLevel>
        <TileCountX>2</TileCountX>
        <TileCountY>1</TileCountY>
        <YOrigin>top</YOrigin>
    </DataWindow>
    <Projection>EPSG:4326</Projection>
    <BlockSizeX>512</BlockSizeX>
    <BlockSizeY>512</BlockSizeY>
    <BandsCount>4</BandsCount>
</GDAL_WMS>

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

1 Answer 1

1

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

1
  • Yo, mark it answered :) Commented Jan 1, 2021 at 20:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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