<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="color: rgb(0, 0, 0); font-family: Calibri,Helvetica,sans-serif; font-size: 12pt;">
<span>Hi Jukka,</span></div>
<div style="color: rgb(0, 0, 0); font-family: Calibri,Helvetica,sans-serif; font-size: 12pt;">
<span><br>
</span></div>
<div style="color: rgb(0, 0, 0); font-family: Calibri,Helvetica,sans-serif; font-size: 12pt;">
<span>I hit "Send" before knowing that Even had replied you. </span><br>
</div>
<div style="color: rgb(0, 0, 0); font-family: Calibri,Helvetica,sans-serif; font-size: 12pt;">
<br>
</div>
<div style="color: rgb(0, 0, 0); font-family: Calibri,Helvetica,sans-serif; font-size: 12pt;">
Ivan</div>
<div style="color: rgb(0, 0, 0); font-family: Calibri,Helvetica,sans-serif; font-size: 12pt;">
<br>
</div>
<div style="color: rgb(0, 0, 0); font-family: Calibri,Helvetica,sans-serif; font-size: 12pt;">
<br>
</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Rahkonen Jukka (MML) <jukka.rahkonen@maanmittauslaitos.fi><br>
<b>Sent:</b> Wednesday, April 8, 2020 12:52 PM<br>
<b>To:</b> Ivan Lucena <ivan.lucena@outlook.com>; 'gdal-dev@lists.osgeo.org' <gdal-dev@lists.osgeo.org><br>
<b>Subject:</b> Re: How to get a file list from a Sentinel zip?</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText"><br>
<br>
Ivan Lucena <ivan.lucena@outlook.com>  wrote:<br>
<br>
> Jukka,<br>
<br>
>> gdalinfo S2A_MSIL2A_20200403T092021_N0214_R093_T34TFS_20200403T114409.zip<br>
>><br>
>> ...if I rename the zip file into "test.zip" I can get the file list.<br>
>> gdalinfo /vsizip/test.zip<br>
<br>
>You did more than renaming the file, you also added /vsizip/ but it might be a typo while editing the e-mail.<br>
No, it was not a typo but I did not mention that when the name of the zip file does not match the Sentinel autorecognition then using /vsizip/ is necessary or otherwise happens this:<br>
<br>
gdalinfo test.zip<br>
ERROR 4: `test.zip' not recognized as a supported file format.<br>
gdalinfo failed - unable to open 'test.zip'.<br>
<br>
>What do you get from:<br>
<br>
>gdalinfo /vsizip/S2A_MSIL2A_20200403T092021_N0214_R093_T34TFS_20200403T114409.zip<br>
This command returns the list of Sentinel raster subdatasets and the result is the same than by running gdalinfo /vsizip/<br>
<br>
> or the SUBDATASET_N_NAME contents you showed:<br>
<br>
>gdalinfo /vsizip/S2A_MSIL2A_20200403T092021_N0214_R093_T34TFS_20200403T114409.zip/S2A_MSIL2A_20200403T092021_N0214_R093_T34TFS_20200403T114409.SAFE/MTD_MSIL2A.xml:10m:EPSG_32634<br>
<br>
The name of the subdataset is actually longer and contains also prefix "SENTINEL2_L2A:" as gdalinfo also reports it. Gdalinfo about the subdataset works as it is supposed to work with command<br>
<br>
gdalinfo 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<br>
<br>
What I was interested in is not the Sentinel rasters but the vector data from the Quality Indicator (QI) directory: cloud mask vectors and defective pixels mask. I can find them by listing the files from the archive with some zip utility like 7-zip on Windows.
 Someone who really works with Sentinel data would probably appreciate some convenient method for finding at least all the cloud masks but I am just curious because I saw this question in gis.stackexchange
<a href="https://gis.stackexchange.com/questions/357540/how-to-use-gdal-vsizip-to-access-gml-files-from-sentinel-2-zip-package/357589">
https://gis.stackexchange.com/questions/357540/how-to-use-gdal-vsizip-to-access-gml-files-from-sentinel-2-zip-package/357589</a>.<br>
<br>
<br>
-Jukka-<br>
<br>
>I hope it helps,<br>
<br>
<br>
>Ivan<br>
<br>
<br>
________________________________________<br>
From: gdal-dev <<a href="mailto:gdal-dev-bounces@lists.osgeo.org">mailto:gdal-dev-bounces@lists.osgeo.org</a>> on behalf of Rahkonen Jukka (MML) <<a href="mailto:jukka.rahkonen@maanmittauslaitos.fi">mailto:jukka.rahkonen@maanmittauslaitos.fi</a>><br>
Sent: Wednesday, April 8, 2020 10:06 AM<br>
To: 'gdal-dev@lists.osgeo.org' <<a href="mailto:gdal-dev@lists.osgeo.org">mailto:gdal-dev@lists.osgeo.org</a>><br>
Subject: [gdal-dev] How to get a file list from a Sentinel zip? <br>
 <br>
Hi,<br>
 <br>
I am investigating this dataset <a href="https://scihub.copernicus.eu/dhus/odata/v1/Products('456d05ea-835f-4e6c-b957-751c155252a1')/%24value">
https://scihub.copernicus.eu/dhus/odata/v1/Products('456d05ea-835f-4e6c-b957-751c155252a1')/%24value</a><br>
download with test/test (890 MB)<br>
 <br>
There seems to be some automagic logic that recognizes that the zip is a Sentinel zip<br>
 <br>
gdalinfo S2A_MSIL2A_20200403T092021_N0214_R093_T34TFS_20200403T114409.zip<br>
.<br>
Subdatasets:<br>
  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<br>
  SUBDATASET_1_DESC=Bands B2, B3, B4, B8 with 10m resolution, UTM 34N<br>
  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<br>
  SUBDATASET_2_DESC=Bands B5, B6, B7, B8A, B11, B12 with 20m resolution, UTM 34N<br>
  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<br>
  SUBDATASET_3_DESC=Bands B1, B9 with 60m resolution, UTM 34N<br>
  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<br>
  SUBDATASET_4_DESC=True color image, UTM 34N<br>
 <br>
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.<br>
 <br>
gdalinfo /vsizip/test.zip<br>
ERROR 4: `/vsizip/test.zip' not recognized as a supported file format.<br>
gdalinfo failed - unable to open '/vsizip/test.zip'.<br>
Unable to open source `/vsizip/test.zip' directly.<br>
The archive contains 146 files:<br>
       /vsizip/test.zip/S2A_MSIL2A_20200403T092021_N0214_R093_T34TFS_20200403T114409.SAFE/<br>
. . .<br>
/vsizip/test.zip/S2A_MSIL2A_20200403T092021_N0214_R093_T34TFS_20200403T114409.SAFE/GRANULE/L2A_T34TFS_A024972_20200403T092024/QI_DATA/MSK_TECQUA_B02.gml<br>
 <br>
Now I can read the gml file with ogrinfo<br>
ogrinfo /vsizip/test.zip/S2A_MSIL2A_20200403T092021_N0214_R093_T34TFS_20200403T114409.SAFE/GRANULE/L2A_T34TFS_A024972_20200403T092024/QI_DATA/MSK_TECQUA_B02.gml<br>
 <br>
and the command also works also with the original name of the zip S2A_MSIL2A_20200403T092021_N0214_R093_T34TFS_20200403T114409.zip.<br>
 <br>
Two questions:<br>
. 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?<br>
. I must read the file list with gdalinfo because ogrinfo does not work with this kind of zip with subdirectories<br>
 <br>
ogrinfo /vsizip/test.zip<br>
FAILURE:<br>
Unable to open datasource `/vsizip/test.zip' with the following drivers.<br>
 <br>
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?<br>
 <br>
-Jukka Rahkonen-<br>
 <br>
 <br>
 <br>
</div>
</span></font></div>
</body>
</html>