[gdal-dev] How to get a file list from a Sentinel zip?

Rahkonen Jukka (MML) jukka.rahkonen at maanmittauslaitos.fi
Wed Apr 8 07:06:30 PDT 2020


Hi,

I am investigating this dataset https://scihub.copernicus.eu/dhus/odata/v1/Products('456d05ea-835f-4e6c-b957-751c155252a1')/%24value
download with test/test (890 MB)

There seems to be some automagic logic that recognizes that the zip is a Sentinel zip

gdalinfo S2A_MSIL2A_20200403T092021_N0214_R093_T34TFS_20200403T114409.zip
...
Subdatasets:
  SUBDATASET_1_NAME=SENTINEL2_L2A:/vsizip/S2A_MSIL2A_20200403T092021_N0214_R093_T34TFS_20200403T114409.zip/S2A_MSIL2A_20200403T092021_N0214_R093_T34TFS_20200403T114409.SAFE/MTD_MSIL2A.xml:10m:EPSG_32634
  SUBDATASET_1_DESC=Bands B2, B3, B4, B8 with 10m resolution, UTM 34N
  SUBDATASET_2_NAME=SENTINEL2_L2A:/vsizip/S2A_MSIL2A_20200403T092021_N0214_R093_T34TFS_20200403T114409.zip/S2A_MSIL2A_20200403T092021_N0214_R093_T34TFS_20200403T114409.SAFE/MTD_MSIL2A.xml:20m:EPSG_32634
  SUBDATASET_2_DESC=Bands B5, B6, B7, B8A, B11, B12 with 20m resolution, UTM 34N
  SUBDATASET_3_NAME=SENTINEL2_L2A:/vsizip/S2A_MSIL2A_20200403T092021_N0214_R093_T34TFS_20200403T114409.zip/S2A_MSIL2A_20200403T092021_N0214_R093_T34TFS_20200403T114409.SAFE/MTD_MSIL2A.xml:60m:EPSG_32634
  SUBDATASET_3_DESC=Bands B1, B9 with 60m resolution, UTM 34N
  SUBDATASET_4_NAME=SENTINEL2_L2A:/vsizip/S2A_MSIL2A_20200403T092021_N0214_R093_T34TFS_20200403T114409.zip/S2A_MSIL2A_20200403T092021_N0214_R093_T34TFS_20200403T114409.SAFE/MTD_MSIL2A.xml:TCI:EPSG_32634
  SUBDATASET_4_DESC=True color image, UTM 34N

However, the zip file contains also vector data in gml format. Those files gets hidden by the Sentinel auto-recognizing system but if I rename the zip file into "test.zip" I can get the file list.

gdalinfo /vsizip/test.zip
ERROR 4: `/vsizip/test.zip' not recognized as a supported file format.
gdalinfo failed - unable to open '/vsizip/test.zip'.
Unable to open source `/vsizip/test.zip' directly.
The archive contains 146 files:
       /vsizip/test.zip/S2A_MSIL2A_20200403T092021_N0214_R093_T34TFS_20200403T114409.SAFE/
. . .
/vsizip/test.zip/S2A_MSIL2A_20200403T092021_N0214_R093_T34TFS_20200403T114409.SAFE/GRANULE/L2A_T34TFS_A024972_20200403T092024/QI_DATA/MSK_TECQUA_B02.gml

Now I can read the gml file with ogrinfo
ogrinfo /vsizip/test.zip/S2A_MSIL2A_20200403T092021_N0214_R093_T34TFS_20200403T114409.SAFE/GRANULE/L2A_T34TFS_A024972_20200403T092024/QI_DATA/MSK_TECQUA_B02.gml

and the command also works also with the original name of the zip S2A_MSIL2A_20200403T092021_N0214_R093_T34TFS_20200403T114409.zip.

Two questions:

  *   How to read the full file list of a zip file that follows the structure and naming convention of Sentinel zips without using the rename trick?
  *   I must read the file list with gdalinfo because ogrinfo does not work with this kind of zip with subdirectories


ogrinfo /vsizip/test.zip
FAILURE:
Unable to open datasource `/vsizip/test.zip' with the following drivers.

Is this worth making a feature request or is there some good reason why ogrinfo cannot read the file list from zip while gdalinfo can?

-Jukka Rahkonen-



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20200408/0f7b8cb6/attachment.html>


More information about the gdal-dev mailing list