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

Ivan Lucena ivan.lucena at outlook.com
Wed Apr 8 07:24:25 PDT 2020


Jukka,

> gdalinfo S2A_MSIL2A_20200403T092021_N0214_R093_T34TFS_20200403T114409.zip

> ...if I rename the zip file into “test.zip” I can get the file list.

> gdalinfo /vsizip/test.zip

You did more than renaming the file, you also added /vsizip/ but it might be a typo while editing the e-mail.

What do you get from:

gdalinfo /vsizip/S2A_MSIL2A_20200403T092021_N0214_R093_T34TFS_20200403T114409.zip

or the SUBDATASET_N_NAME contents you showed:

gdalinfo /vsizip/S2A_MSIL2A_20200403T092021_N0214_R093_T34TFS_20200403T114409.zip/S2A_MSIL2A_20200403T092021_N0214_R093_T34TFS_20200403T114409.SAFE/MTD_MSIL2A.xml:10m:EPSG_32634

?

I hope it helps,

Ivan

________________________________
From: gdal-dev <gdal-dev-bounces at lists.osgeo.org> on behalf of Rahkonen Jukka (MML) <jukka.rahkonen at maanmittauslaitos.fi>
Sent: Wednesday, April 8, 2020 10:06 AM
To: 'gdal-dev at lists.osgeo.org' <gdal-dev at lists.osgeo.org>
Subject: [gdal-dev] How to get a file list from a Sentinel zip?


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/997013ac/attachment-0001.html>


More information about the gdal-dev mailing list