[GIS] GDAL Virtual File System (vsitar, vsizip, vsicurl) not working

gdal

I want to access a landsat tar file like :

gdalinfo "/vsitar/vsicurl/https://dds.cr.usgs.gov/ltaauth/hsm/lsat1/collection01/oli_tirs/T1/2018/146/039/LC08_L1TP_146039_20180119_20180206_01_T1.tar.gz?id=ndauj8dbfj9tgucjgsu0l38sst&iid=LC81460392018019LGN00&did=543821091&ver=production"

But in my case it is not working.

enterERROR 4: '/vsitar/vsicurl/https://dds.cr.usgs.gov/ltaauth/hsm/lsat1/collection01/oli_tirs/T1/2018/146/039/LC08_L1TP_146039_20180119_20180206_01_T1.tar.gz?id=ndauj8dbfj9tgucjgsu0l38sst&iid=LC81460392018019LGN00&did=543821091&ver=production' does not exist in the file system, and is not recognized as a supported dataset name.
gdalinfo failed - unable to open '/vsitar/vsicurl/https://dds.cr.usgs.gov/ltaauth/hsm/lsat1/collection01/oli_tirs/T1/2018/146/039/LC08_L1TP_146039_20180119_20180206_01_T1.tar.gz?id=ndauj8dbfj9tgucjgsu0l38sst&iid=LC81460392018019LGN00&did=543821091&ver=production

In a ftp in my LAN it is working fine.

What is the problem?

Best Answer

I couldn't open it using /vsigzip//vsicurl/ or /vsitar//vsicurl/.

It's a tar.gz of multiple files. Your best option is to download it (manually or you can script with curl or wget, or in python via the requests library). Once you have downloaded it, you can use /vsitar/ to read it:

gdalinfo /vsitar/LC08_L1TP_146039_20180119_20180206_01_T1.tar.gz

ERROR 4: `/vsitar/LC08_L1TP_146039_20180119_20180206_01_T1.tar.gz' not recognized as a supported file format.
gdalinfo failed - unable to open '/vsitar/LC08_L1TP_146039_20180119_20180206_01_T1.tar.gz'.
Unable to open source `/vsitar/LC08_L1TP_146039_20180119_20180206_01_T1.tar.gz' directly.
The archive contains 14 files:
       /vsitar/LC08_L1TP_146039_20180119_20180206_01_T1.tar.gz/LC08_L1TP_146039_20180119_20180206_01_T1_B1.TIF
       /vsitar/LC08_L1TP_146039_20180119_20180206_01_T1.tar.gz/LC08_L1TP_146039_20180119_20180206_01_T1_B2.TIF
       /vsitar/LC08_L1TP_146039_20180119_20180206_01_T1.tar.gz/LC08_L1TP_146039_20180119_20180206_01_T1_B3.TIF
       /vsitar/LC08_L1TP_146039_20180119_20180206_01_T1.tar.gz/LC08_L1TP_146039_20180119_20180206_01_T1_B4.TIF
       /vsitar/LC08_L1TP_146039_20180119_20180206_01_T1.tar.gz/LC08_L1TP_146039_20180119_20180206_01_T1_B5.TIF
       /vsitar/LC08_L1TP_146039_20180119_20180206_01_T1.tar.gz/LC08_L1TP_146039_20180119_20180206_01_T1_B6.TIF
       /vsitar/LC08_L1TP_146039_20180119_20180206_01_T1.tar.gz/LC08_L1TP_146039_20180119_20180206_01_T1_B7.TIF
       /vsitar/LC08_L1TP_146039_20180119_20180206_01_T1.tar.gz/LC08_L1TP_146039_20180119_20180206_01_T1_B8.TIF
       /vsitar/LC08_L1TP_146039_20180119_20180206_01_T1.tar.gz/LC08_L1TP_146039_20180119_20180206_01_T1_B9.TIF
       /vsitar/LC08_L1TP_146039_20180119_20180206_01_T1.tar.gz/LC08_L1TP_146039_20180119_20180206_01_T1_B10.TIF
       /vsitar/LC08_L1TP_146039_20180119_20180206_01_T1.tar.gz/LC08_L1TP_146039_20180119_20180206_01_T1_B11.TIF
       /vsitar/LC08_L1TP_146039_20180119_20180206_01_T1.tar.gz/LC08_L1TP_146039_20180119_20180206_01_T1_BQA.TIF
       /vsitar/LC08_L1TP_146039_20180119_20180206_01_T1.tar.gz/LC08_L1TP_146039_20180119_20180206_01_T1_ANG.txt
       /vsitar/LC08_L1TP_146039_20180119_20180206_01_T1.tar.gz/LC08_L1TP_146039_20180119_20180206_01_T1_MTL.txt

gdalinfo /vsitar/LC08_L1TP_146039_20180119_20180206_01_T1.tar.gz/LC08_L1TP_146039_20180119_20180206_01_T1_B11.TIF

Driver: GTiff/GeoTIFF
Files: /vsitar/LC08_L1TP_146039_20180119_20180206_01_T1.tar.gz/LC08_L1TP_146039_20180119_20180206_01_T1_B11.TIF
       /vsitar/LC08_L1TP_146039_20180119_20180206_01_T1.tar.gz/LC08_L1TP_146039_20180119_20180206_01_T1_MTL.txt
Size is 7781, 7911
Coordinate System is:
PROJCS["WGS 84 / UTM zone 44N",
    GEOGCS["WGS 84",
        DATUM["WGS_1984",
            SPHEROID["WGS 84",6378137,298.257223563,
                AUTHORITY["EPSG","7030"]],
            AUTHORITY["EPSG","6326"]],
        PRIMEM["Greenwich",0,
            AUTHORITY["EPSG","8901"]],
        UNIT["degree",0.0174532925199433,
            AUTHORITY["EPSG","9122"]],
        AUTHORITY["EPSG","4326"]],
    PROJECTION["Transverse_Mercator"],
    PARAMETER["latitude_of_origin",0],
    PARAMETER["central_meridian",81],
    PARAMETER["scale_factor",0.9996],
    PARAMETER["false_easting",500000],
    PARAMETER["false_northing",0],
    UNIT["metre",1,
        AUTHORITY["EPSG","9001"]],
    AXIS["Easting",EAST],
    AXIS["Northing",NORTH],
    AUTHORITY["EPSG","32644"]]
Origin = (122385.000000000000000,3474015.000000000000000)
Pixel Size = (30.000000000000000,-30.000000000000000)
Metadata:
  AREA_OR_POINT=Point
  METADATATYPE=ODL
Image Structure Metadata:
  INTERLEAVE=BAND
Corner Coordinates:
Upper Left  (  122385.000, 3474015.000) ( 77d 1'54.67"E, 31d20'21.52"N)
Lower Left  (  122385.000, 3236685.000) ( 77d 7' 1.25"E, 29d12' 9.48"N)
Upper Right (  355815.000, 3474015.000) ( 79d29' 0.67"E, 31d23'30.36"N)
Lower Right (  355815.000, 3236685.000) ( 79d30'58.14"E, 29d15' 2.88"N)
Center      (  239100.000, 3355350.000) ( 78d17'13.77"E, 30d18' 6.61"N)
Band 1 Block=7781x1 Type=UInt16, ColorInterp=Gray
Related Question