[gdal-dev] Reading SRTM30 grids 'at distance'

Even Rouault even.rouault at mines-paris.org
Mon Nov 14 13:54:07 EST 2011


Le lundi 14 novembre 2011 18:23:23, Joaquim Luis a écrit :
> Hi,
> 
> I made a nice little tool for Mirone where one can very easily mosaic
> either several flavors of SRTM grids or satellite images from Bing servers.
> My question is about the SRTM30 grids (30 arc minutes) that are
> available here (SRTM plus)
> ftp://topex.ucsd.edu/pub/srtm30_plus/srtm30/data/
> which I would like to be able to access directly with the vsicurl
> mechanism. The trouble in this case is that those grids are raw files
> without any header file. When we have them on disk the simple solution
> is to create a esri .hdr header from the information extracted from the
> file name. However, this logic does not work for files seating in the
> Web because the file and the header won't be located next to each other.
> The same occurs if one has those files compressed. In this case the
> header file cannot be assumed to be stored inside the .zip file and the
> vsizip mechanism will fail for exactly the same reason.
> My question is than, if there is a mechanism to send the header info to
> the GDAL library and thus pretend that file and header leave side by
> side? Note that I want to do this programmatically so need for an
> already existing ready to use solution.

One way to do this is to use the capability of VRT files to describe raw files ( 
http://www.gdal.org/gdal_vrttut.html ), that offer similar capabilities than 
the EHdr header.

For e020n40.Bathymetry.srtm, a quick test shows that the following should do :

<VRTDataset rasterXSize="4800" rasterYSize="6000">
  <SRS>GEOGCS[&quot;WGS 84&quot;,DATUM[&quot;WGS_1984&quot;,SPHEROID[&quot;WGS 
84&quot;,6378137,298.257223563,AUTHORITY[&quot;EPSG&quot;,&quot;7030&quot;]],AUTHORITY[&quot;EPSG&quot;,&quot;6326&quot;]],PRIMEM[&quot;Greenwich&quot;,0,AUTHORITY[&quot;EPSG&quot;,&quot;8901&quot;]],UNIT[&quot;degree&quot;,0.0174532925199433,AUTHORITY[&quot;EPSG&quot;,&quot;9122&quot;]],AUTHORITY[&quot;EPSG&quot;,&quot;4326&quot;]]</SRS>
  <GeoTransform>20, 0.008333333333333,  0.0,  40,  0.0, 
-0.008333333333333</GeoTransform>
  <VRTRasterBand dataType="Int16" band="1" subClass="VRTRawRasterBand">
    <SourceFilename 
relativetoVRT="0">/vsicurl/ftp://topex.ucsd.edu/pub/srtm30_plus/srtm30/data/e020n40.Bathymetry.srtm</SourceFilename>
    <ImageOffset>0</ImageOffset>
    <PixelOffset>2</PixelOffset>
    <LineOffset>9600</LineOffset>
    <ByteOrder>MSB</ByteOrder>
  </VRTRasterBand>
</VRTDataset>

(I've attached it to avoid line wrapping problems)



> 
> Thanks
> 
> Joaquim
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
-------------- next part --------------
<VRTDataset rasterXSize="4800" rasterYSize="6000">
  <SRS>GEOGCS[&quot;WGS 84&quot;,DATUM[&quot;WGS_1984&quot;,SPHEROID[&quot;WGS 84&quot;,6378137,298.257223563,AUTHORITY[&quot;EPSG&quot;,&quot;7030&quot;]],AUTHORITY[&quot;EPSG&quot;,&quot;6326&quot;]],PRIMEM[&quot;Greenwich&quot;,0,AUTHORITY[&quot;EPSG&quot;,&quot;8901&quot;]],UNIT[&quot;degree&quot;,0.0174532925199433,AUTHORITY[&quot;EPSG&quot;,&quot;9122&quot;]],AUTHORITY[&quot;EPSG&quot;,&quot;4326&quot;]]</SRS>
  <GeoTransform>20, 0.008333333333333,  0.0,  40,  0.0, -0.008333333333333</GeoTransform>
  <VRTRasterBand dataType="Int16" band="1" subClass="VRTRawRasterBand">
    <SourceFilename relativetoVRT="0">/vsicurl/ftp://topex.ucsd.edu/pub/srtm30_plus/srtm30/data/e020n40.Bathymetry.srtm</SourceFilename>
    <ImageOffset>0</ImageOffset>
    <PixelOffset>2</PixelOffset>
    <LineOffset>9600</LineOffset>
    <ByteOrder>MSB</ByteOrder>
  </VRTRasterBand>
</VRTDataset>


More information about the gdal-dev mailing list