0

I'm attempting to mosaic together 9 SRTM tiles downloaded from CGIAR to produce a DEM of Borneo. I'm using:

gdalbuildvrt Borneo.vrt BorneoSRTM/*.tif

where BorneoSRTM contains the 9 tif files to be combined. The command runs without error, however the resulting DEM looks like the below image and all the elevations are less than 13m (some of the input files have elevations close to 4000 m). enter image description here

Clearly there's a problem with the tile corresponding to the big white square (5-10N, 110-115E). Looking at the original tif files and I've noticed that NoData is 255 for the problem tile and -32768 for all others. I tried changing NoData to -32768 using:

gdal_translate -a_nodata -32768  srtm_59_11.tif  out.tif

but this didn't solve the problem.

Calling gdalinfo on the problem tile gives:

Driver: GTiff/GeoTIFF
Files: srtm_59_11.tif
       srtm_59_11.tfw
Size is 6001, 6001
Coordinate System is:
GEOGCS["WGS 84",
    DATUM["WGS_1984",
        SPHEROID["WGS 84",6378137,298.257223563,
            AUTHORITY["EPSG","7030"]],
        AUTHORITY["EPSG","6326"]],
    PRIMEM["Greenwich",0],
    UNIT["degree",0.0174532925199433],
    AUTHORITY["EPSG","4326"]]
Origin = (109.999583817610983,10.000416763514124)
Pixel Size = (0.000833333333333,-0.000833333333333)
Metadata:
  AREA_OR_POINT=Area
Image Structure Metadata:
  INTERLEAVE=BAND
Corner Coordinates:
Upper Left  ( 109.9995838,  10.0004168) 
Lower Left  ( 109.9995838,   4.9995834) 
Upper Right ( 115.0004172,  10.0004168) 
Lower Right ( 115.0004172,   4.9995834) 
Center      ( 112.5000005,   7.5000001) 
Band 1 Block=6001x1 Type=Int16, ColorInterp=Gray
  NoData Value=255

And, calling it on another tile gives:

Driver: GTiff/GeoTIFF
Files: srtm_59_12.tif
       srtm_59_12.tfw
Size is 6001, 6001
Coordinate System is:
GEOGCS["WGS 84",
    DATUM["WGS_1984",
        SPHEROID["WGS 84",6378137,298.257223563,
            AUTHORITY["EPSG","7030"]],
        AUTHORITY["EPSG","6326"]],
    PRIMEM["Greenwich",0],
    UNIT["degree",0.0174532925199433],
    AUTHORITY["EPSG","4326"]]
Origin = (109.999583817610983,5.000416642442191)
Pixel Size = (0.000833333333333,-0.000833333333333)
Metadata:
  AREA_OR_POINT=Area
Image Structure Metadata:
  INTERLEAVE=BAND
Corner Coordinates:
Upper Left  ( 109.9995838,   5.0004166) 
Lower Left  ( 109.9995838,  -0.0004167) 
Upper Right ( 115.0004172,   5.0004166) 
Lower Right ( 115.0004172,  -0.0004167) 
Center      ( 112.5000005,   2.5000000) 
Band 1 Block=6001x1 Type=Int16, ColorInterp=Gray
  NoData Value=-32768

When I call gdalbuildvrt without this problem tile, everything works fine. I realize that this tile only includes a tiny piece of Borneo, but if possible I'd like to figure out a way to include it.

  • 1
    Are you required to use the 3-arc second SRTM data for some reason? If not you could also use the, somewhat newly, released 1-arc second available on EarthExplorer. This would give you higher accuracy and I guess also solve the issue with the corrupt no_data value. – Kersten Mar 26 '15 at 15:45
  • I wasn't aware that they had released the higher resolution data. I'll take a look. Thanks! – Matt SM Mar 26 '15 at 17:00
2

GDALbuildVRT http://www.gdal.org/gdalbuildvrt.html has a switch -vrtnodata value [value...]: this allows you to set multiple input nodata values, provided both values are OK to be set as NoData (i.e. -32768 and 255 for all images) otherwise you will have to translate somehow so they all have the same nodata value. GDAL_Translate with -a_nodata value will set the value but doesn't change the existing nodata to the new value.

If you want to change the actual nodata value in the images then use GDAL_Translate to export to AAIGRID format Arc/INFO ASCII grid then open in a good text editor (TextPad, Notepad++) and do a find-and-replace on the nodata value (don't forget the trailing 0's) then translate back into something more useful like HFA or GTIFF.

Alternately MicroImages TNT mips Microimages Web site has a utility to change nodata value and the light version may work on files that small.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.