[gdal-dev] accessing zip files by URL

Even Rouault even.rouault at mines-paris.org
Thu Mar 24 13:45:14 EDT 2011


Joaquim,

The correct syntax would be :

gdalinfo 
/vsizip/vsicurl/http://dds.cr.usgs.gov/srtm/version2_1/SRTM30/w020n90/w020n90.dem.zip/W020N90.DEM

or just :

gdalinfo 
/vsizip/vsicurl/http://dds.cr.usgs.gov/srtm/version2_1/SRTM30/w020n90/w020n90.dem.zip

because the zip file only contains one single file (W020N90.DEM)

... But the W020N90.DEM inside the zip file isn't directly recognized by GDAL 
(even if you download it and unzip the file). It's just a RAW file, that neads 
an header to tell the dimension, georeferencing, datatype etc, so the above 
won't directly work.

You can for example create a VRT that refers to the raw file :

<VRTDataset rasterXSize="4800" rasterYSize="6000">
  <GeoTransform>-20, 8.3333333333300008e-03,  0,  90,  0, 
-8.3333333333300008e-03</GeoTransform>
  <VRTRasterBand dataType="Int16" band="1" subClass="VRTRawRasterBand">
    <NoDataValue>-9999</NoDataValue>
    <SourceFilename 
relativetoVRT="0">/vsizip/vsicurl/http://dds.cr.usgs.gov/srtm/version2_1/SRTM30/w020n90/w020n90.dem.zip</SourceFilename>
    <ByteOrder>MSB</ByteOrder>
  </VRTRasterBand>
</VRTDataset>

I've deduced this VRT from the 
http://dds.cr.usgs.gov/srtm/version2_1/SRTM30/w020n90/w020n90.hdr.zip file that 
sits next to the .dem.zip file.

It's a shame that they didn't put the .hdr and the .dem file inside the same 
zip. It would have they been possible to open it directly...

With the SRTM3 in HGT format, you can directly do :

gdalinfo 
/vsizip/vsicurl/http://dds.cr.usgs.gov/srtm/version2_1/SRTM3/Africa/N00E006.hgt.zip

Best regards,

Even

> Hi,
> 
> How do we access to a compressed files by URL? We can do that, can't we?
> 
> As an example I try this (on Windows)
> 
> gdalinfo
> /vsizip/C:\http://dds.cr.usgs.gov/srtm/version2_1/SRTM30/w020n90/w020n90.de
> m.zip ERROR 4:
> `/vsizip/C:\http://dds.cr.usgs.gov/srtm/version2_1/SRTM30/w020n90/w020n90.d
> em.zip' does not exist in the file system,
> and is not recognised as a supported dataset name.
> 
> and this
> 
> gdalinfo
> /vsizip//http://dds.cr.usgs.gov/srtm/version2_1/SRTM30/w020n90/w020n90.dem.
> zip
> 
> but the error message is similar.
> 
> The idea is to fetch the data directly into GMT, but first I need to
> understand well how it works.
> 
> Thanks
> 
> Joaquim Luis
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev


More information about the gdal-dev mailing list