<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
<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>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><span style="display: inline !important; background-color: rgb(255, 255, 255); font-size-adjust: none">> gdalinfo S2A_MSIL2A_20200403T092021_N0214_R093_T34TFS_20200403T114409.zip</span></span><span><span lang="EN-US" style="border-bottom-color: currentColor; border-left-color: currentColor; border-right-color: currentColor; border-top-color: currentColor; font-size-adjust: none; margin-bottom: 0px; margin-top: 0px"><br>
</span></span></div>
<div style="color: rgb(0, 0, 0); font-family: Calibri,Helvetica,sans-serif; font-size: 12pt;">
<span>
<p style="color: rgb(32, 31, 30); font-family: &quot; font-size: 11pt; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm">
<span lang="EN-US" style="border-bottom-color: currentColor; border-left-color: currentColor; border-right-color: currentColor; border-top-color: currentColor; font-size-adjust: none; margin-bottom: 0px; margin-top: 0px">> ...if I rename the zip file into “test.zip”
 I can get the file list.</span><br>
</p>
<span style="display: inline !important; background-color: rgb(255, 255, 255); font-size-adjust: none"></span>
<p style="color: rgb(32, 31, 30); font-family: &quot; font-size: 11pt; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm">
<span lang="EN-US" style="border-bottom-color: currentColor; border-left-color: currentColor; border-right-color: currentColor; border-top-color: currentColor; font-size-adjust: none; margin-bottom: 0px; margin-top: 0px">> gdalinfo /vsizip/test.zip</span></p>
<div><br>
</div>
<div>You did more than renaming the file, you also added /vsizip/ but it might be a typo while editing the e-mail.</div>
<div><br>
</div>
<div>What do you get from:</div>
<div><br>
</div>
<div><span style="display: inline !important; background-color: rgb(255, 255, 255); font-size-adjust: none">gdalinfo
<span style="display: inline !important; background-color: rgb(255, 255, 255); font-size-adjust: none">
/vsizip/</span>S2A_MSIL2A_20200403T092021_N0214_R093_T34TFS_20200403T114409.zip</span></div>
<div><br>
</div>
<div>or the SUBDATASET_N_NAME contents you showed:</div>
<div><br>
</div>
<div>gdalinfo <span style="display: inline !important; background-color: rgb(255, 255, 255); font-size-adjust: none">/vsizip/S2A_MSIL2A_20200403T092021_N0214_R093_T34TFS_20200403T114409.zip/S2A_MSIL2A_20200403T092021_N0214_R093_T34TFS_20200403T114409.SAFE/MTD_MSIL2A.xml:10m:EPSG_32634</span></div>
<div><span style="display: inline !important; background-color: rgb(255, 255, 255); font-size-adjust: none"><br>
</span></div>
<div><span style="display: inline !important; background-color: rgb(255, 255, 255); font-size-adjust: none">?</span></div>
<div><span style="display: inline !important; background-color: rgb(255, 255, 255); font-size-adjust: none"><br>
</span></div>
<div><span style="display: inline !important; background-color: rgb(255, 255, 255); font-size-adjust: none">I hope it helps,</span></div>
<div><span style="display: inline !important; background-color: rgb(255, 255, 255); font-size-adjust: none"><br>
</span></div>
<div><span style="display: inline !important; background-color: rgb(255, 255, 255); font-size-adjust: none">Ivan</span></div>
<div><span style="display: inline !important; background-color: rgb(255, 255, 255); font-size-adjust: none"><br>
</span></div>
</span></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> gdal-dev <gdal-dev-bounces@lists.osgeo.org> on behalf of Rahkonen Jukka (MML) <jukka.rahkonen@maanmittauslaitos.fi><br>
<b>Sent:</b> Wednesday, April 8, 2020 10:06 AM<br>
<b>To:</b> 'gdal-dev@lists.osgeo.org' <gdal-dev@lists.osgeo.org><br>
<b>Subject:</b> [gdal-dev] How to get a file list from a Sentinel zip?</font>
<div> </div>
</div>
<style>
<!--
@font-face
        {font-family:Wingdings}
@font-face
        {font-family:"Cambria Math"}
@font-face
        {font-family:Calibri}
p.x_MsoNormal, li.x_MsoNormal, div.x_MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif}
a:link, span.x_MsoHyperlink
        {color:#0563C1;
        text-decoration:underline}
a:visited, span.x_MsoHyperlinkFollowed
        {color:#954F72;
        text-decoration:underline}
p.x_MsoListParagraph, li.x_MsoListParagraph, div.x_MsoListParagraph
        {margin-top:0cm;
        margin-right:0cm;
        margin-bottom:0cm;
        margin-left:36.0pt;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif}
span.x_Shkpostityyli17
        {font-family:"Calibri",sans-serif;
        color:windowtext}
.x_MsoChpDefault
        {font-family:"Calibri",sans-serif}
@page WordSection1
        {margin:70.85pt 2.0cm 70.85pt 2.0cm}
div.x_WordSection1
        {}
ol
        {margin-bottom:0cm}
ul
        {margin-bottom:0cm}
-->
</style>
<div lang="FI" link="#0563C1" vlink="#954F72">
<div class="x_WordSection1">
<p class="x_MsoNormal">Hi,</p>
<p class="x_MsoNormal"> </p>
<p class="x_MsoNormal"><span lang="EN-US">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)</span></p>
<p class="x_MsoNormal"><span lang="EN-US"> </span></p>
<p class="x_MsoNormal"><span lang="EN-US">There seems to be some automagic logic that recognizes that the zip is a Sentinel zip</span></p>
<p class="x_MsoNormal"><span lang="EN-US"> </span></p>
<p class="x_MsoNormal"><span lang="EN-US">gdalinfo S2A_MSIL2A_20200403T092021_N0214_R093_T34TFS_20200403T114409.zip</span></p>
<p class="x_MsoNormal"><span lang="EN-US">…</span></p>
<p class="x_MsoNormal"><span lang="EN-US">Subdatasets:</span></p>
<p class="x_MsoNormal"><span lang="EN-US">  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</span></p>
<p class="x_MsoNormal"><span lang="EN-US">  SUBDATASET_1_DESC=Bands B2, B3, B4, B8 with 10m resolution, UTM 34N</span></p>
<p class="x_MsoNormal"><span lang="EN-US">  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</span></p>
<p class="x_MsoNormal"><span lang="EN-US">  SUBDATASET_2_DESC=Bands B5, B6, B7, B8A, B11, B12 with 20m resolution, UTM 34N</span></p>
<p class="x_MsoNormal"><span lang="EN-US">  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</span></p>
<p class="x_MsoNormal"><span lang="EN-US">  SUBDATASET_3_DESC=Bands B1, B9 with 60m resolution, UTM 34N</span></p>
<p class="x_MsoNormal"><span lang="EN-US">  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</span></p>
<p class="x_MsoNormal"><span lang="EN-US">  SUBDATASET_4_DESC=True color image, UTM 34N</span></p>
<p class="x_MsoNormal"><span lang="EN-US"> </span></p>
<p class="x_MsoNormal"><span lang="EN-US">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.</span></p>
<p class="x_MsoNormal"><span lang="EN-US"> </span></p>
<p class="x_MsoNormal"><span lang="EN-US">gdalinfo /vsizip/test.zip</span></p>
<p class="x_MsoNormal"><span lang="EN-US">ERROR 4: `/vsizip/test.zip' not recognized as a supported file format.</span></p>
<p class="x_MsoNormal"><span lang="EN-US">gdalinfo failed - unable to open '/vsizip/test.zip'.</span></p>
<p class="x_MsoNormal"><span lang="EN-US">Unable to open source `/vsizip/test.zip' directly.</span></p>
<p class="x_MsoNormal"><span lang="EN-US">The archive contains 146 files:</span></p>
<p class="x_MsoNormal"><span lang="EN-US">       /vsizip/test.zip/S2A_MSIL2A_20200403T092021_N0214_R093_T34TFS_20200403T114409.SAFE/</span></p>
<p class="x_MsoNormal"><span lang="EN-US">. . .</span></p>
<p class="x_MsoNormal"><span lang="EN-US">/vsizip/test.zip/S2A_MSIL2A_20200403T092021_N0214_R093_T34TFS_20200403T114409.SAFE/GRANULE/L2A_T34TFS_A024972_20200403T092024/QI_DATA/MSK_TECQUA_B02.gml</span></p>
<p class="x_MsoNormal"><span lang="EN-US"> </span></p>
<p class="x_MsoNormal"><span lang="EN-US">Now I can read the gml file with ogrinfo</span></p>
<p class="x_MsoNormal"><span lang="EN-US">ogrinfo /vsizip/test.zip/S2A_MSIL2A_20200403T092021_N0214_R093_T34TFS_20200403T114409.SAFE/GRANULE/L2A_T34TFS_A024972_20200403T092024/QI_DATA/MSK_TECQUA_B02.gml</span></p>
<p class="x_MsoNormal"><span lang="EN-US"> </span></p>
<p class="x_MsoNormal"><span lang="EN-US">and the command also works also with the original name of the zip S2A_MSIL2A_20200403T092021_N0214_R093_T34TFS_20200403T114409.zip.</span></p>
<p class="x_MsoNormal"><span lang="EN-US"> </span></p>
<p class="x_MsoNormal"><span lang="EN-US">Two questions:</span></p>
<ul type="disc" style="margin-top:0cm">
<li class="x_MsoListParagraph" style="margin-left:0cm"><span lang="EN-US">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?</span></li><li class="x_MsoListParagraph" style="margin-left:0cm"><span lang="EN-US">I must read the file list with gdalinfo because ogrinfo does not work with this kind of zip with subdirectories</span></li></ul>
<p class="x_MsoListParagraph"><span lang="EN-US"> </span></p>
<p class="x_MsoNormal"><span lang="EN-US">ogrinfo /vsizip/test.zip</span></p>
<p class="x_MsoNormal"><span lang="EN-US">FAILURE:</span></p>
<p class="x_MsoNormal"><span lang="EN-US">Unable to open datasource `/vsizip/test.zip' with the following drivers.</span></p>
<p class="x_MsoNormal"><span lang="EN-US"> </span></p>
<p class="x_MsoNormal"><span lang="EN-US">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?</span></p>
<p class="x_MsoNormal"><span lang="EN-US"> </span></p>
<p class="x_MsoNormal"><span lang="EN-US">-Jukka Rahkonen-</span></p>
<p class="x_MsoNormal"><span lang="EN-US"> </span></p>
<p class="x_MsoNormal"><span lang="EN-US"> </span></p>
<p class="x_MsoNormal"><span lang="EN-US"> </span></p>
</div>
</div>
</body>
</html>