<div dir="ltr">Hello,<div><br></div><div><br></div><div>I have found an odd behavior using the /vsizip driver and I'm hoping someone on this list can explain what is happening.  </div><div><br></div><div>I have a zip file containing a number of files of various types.  For each different dataset there is also a vrt file that is generated by the processing software to access the various binary data files.  If I access one of the vrt files via the command line tools I get something along the lines of:</div><div><br></div><div>







<font face="monospace, monospace">/opt/local/bin/gdalinfo /vsizip/S1-IFG_RM_M1S2_TN027_20170301T132816-20170217T132724_s2-poeorb-76d1-v1.1.3-asf.zip/S1-IFG_RM_M1S2_TN027_20170301T132816-20170217T132724_s2-poeorb-76d1-v1.1.3-asf/merged/phsig.cor.geo.vrt<br>ERROR 1: Random access not supported for /vsizip<br>Driver: VRT/Virtual Raster<br>Files: /vsizip/S1-IFG_RM_M1S2_TN027_20170301T132816-20170217T132724_s2-poeorb-76d1-v1.1.3-asf.zip/S1-IFG_RM_M1S2_TN027_20170301T132816-20170217T132724_s2-poeorb-76d1-v1.1.3-asf/merged/phsig.cor.geo.vrt<br>       /vsizip/S1-IFG_RM_M1S2_TN027_20170301T132816-20170217T132724_s2-poeorb-76d1-v1.1.3-asf.zip/S1-IFG_RM_M1S2_TN027_20170301T132816-20170217T132724_s2-poeorb-76d1-v1.1.3-asf/merged/phsig.cor.geo<br>Size is 5139, 6060<br>Coordinate System is:<br>GEOGCS["WGS 84",<br>    DATUM["WGS_1984",<br>        SPHEROID["WGS 84",6378137,298.257223563,<br>            AUTHORITY["EPSG","7030"]],<br>        AUTHORITY["EPSG","6326"]],<br>    PRIMEM["Greenwich",0,<br>        AUTHORITY["EPSG","8901"]],<br>    UNIT["degree",0.0174532925199433,<br>        AUTHORITY["EPSG","9122"]],<br>    AUTHORITY["EPSG","4326"]]<br>Origin = (-112.731111111111105,33.272777777777776)<br>Pixel Size = (0.000277777777778,-0.000277777777778)<br>Corner Coordinates:<br>Upper Left  (-112.7311111,  33.2727778) (112d43'52.00"W, 33d16'22.00"N)<br>Lower Left  (-112.7311111,  31.5894444) (112d43'52.00"W, 31d35'22.00"N)<br>Upper Right (-111.3036111,  33.2727778) (111d18'13.00"W, 33d16'22.00"N)<br>Lower Right (-111.3036111,  31.5894444) (111d18'13.00"W, 31d35'22.00"N)<br>Center      (-112.0173611,  32.4311111) (112d 1' 2.50"W, 32d25'52.00"N)<br>Band 1 Block=5139x1 Type=Float32, ColorInterp=Undefined</font></div><div><font face="monospace, monospace"><br></font></div><div><br></div><div>This seems perfectly normal and if I use gdal_translate to convert the file to geotiff it looks fine.  Note that I do get the Error 1 message, but this does not seem to impact access.  The problem enters when I try to access the file via the gdal python module.  </div><div><div><br></div><font face="monospace, monospace">>>> from osgeo import gdal<br>>>> han = gdal.Open('/vsizip/S1-IFG_RM_M1S2_TN027_20170301T132816-20170217T132724_s2-poeorb-76d1-v1.1.3-asf.zip/S1-IFG_RM_M1S2_TN027_20170301T132816-20170217T132724_s2-poeorb-76d1-v1.1.3-asf/merged/phsig.cor.geo.vrt',gdal.GA_ReadOnly)<br>ERROR 1: Random access not supported for /vsizip</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="arial, helvetica, sans-serif">Notice the filename is exactly the same as I used with gdalinfo.  I also get the same Error 1 message.  However, this does not actually open the file.  I have tried using the GA_ReadOnly flag and not using it with the same result.</font></div><br><font face="monospace, monospace">>>> print han<br>None<br>>>> print han.GetGeoTransform()<br>Traceback (most recent call last):<br>  File "<stdin>", line 1, in <module><br>AttributeError: 'NoneType' object has no attribute 'GetGeoTransform'</font><div><div><br></div><div>The VRT file looks like this:</div><div><br></div><font face="monospace, monospace">VRTDataset rasterXSize="5139" rasterYSize="6060"><br>    <SRS>EPSG:4326</SRS><br>    <GeoTransform>-112.7311111111111, 0.0002777777777777778, 0.0, 33.272777777777776, 0.0, -0.0002777777777777778</GeoTransform><br>    <VRTRasterBand band="1" dataType="Float32" subClass="VRTRawRasterBand"><br>        <SourceFilename relativeToVRT="1">phsig.cor.geo</SourceFilename><br>        <ByteOrder>LSB</ByteOrder><br>        <ImageOffset>0</ImageOffset><br>        <PixelOffset>4</PixelOffset><br>        <LineOffset>20556</LineOffset><br>    </VRTRasterBand><br></VRTDataset></font><div><br></div><div><br></div><div>I initially thought the problem might be the relativeToVRT=1 flag, since I found an ealier thread in this email list that seems to say that relative paths are not allowed in the /vsizip driver.  However, if that were the case I would have expected the gdalinfo call to fail as well, but it does not.  </div><div><br></div><div>Apologies if this is not the right list for this type of question.  I have been fighting with variants of this problem for a while now and am a bit frustrated.  We want to provide these data files to our users and allow them to access the various layers in place, without unzipping the files.  However, I just can't seem to get this to work.  I would appreciate any comments or thoughts.  </div><div><br></div><div>Thank you,</div><div>Scott</div><div><br></div><div><br></div><div><br></div><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><div>Scott Arko<br>Alaska Satellite Facility Deputy Director<div>University of Alaska Fairbanks<br><br>903 Koyukuk Drive<br>Fairbanks, AK 99775<br>Phone: (907) 474 - 5570<br>email:  <a href="mailto:saarko@alaska.edu" target="_blank">saarko@alaska.edu</a><br><a href="http://www.asf.alaska.edu" target="_blank">http://www.asf.alaska.edu</a></div></div></div></div>
</div></div>