3

I want to over write/mosaic one large DEM (around 3gb file, Geotiff) over another. What is the best way to do this?

Both cover roughly the same region, one is based on 2m res LiDAR, the other 1m res LiDAR. Both data sets have large areas of no data (-9999), and both have a 1m cell size and the same projection. The resulting DEM should have the better quality LiDAR written over the lower quality where it exists.

I have tried using gdal_merge but this does not like the no data switch, takes too much memory (I do have 32gb of Ram). I have tried cutting down the files into smaller segments, but even at two 300mb files it still will not work.

I have tried using gdalwarp (-overwrite) but this simply overwrites the entire file giving me a copy of the 1m res data with no 2m beneath it despite using the no data switch.

I am open to different software, but the resulting file has to be converted into an ASC to be read into a model.

1
  • Do not overwrite with gdalwarp. Just use the image you want to enhance as output and pixel values will be updated. But I do not know how to avoid writing nodata values and wiping the good pixels.
    – user30184
    Jan 14, 2016 at 18:10

1 Answer 1

0

Investigate gdal_calc.py:

gdal_calc.py -A L2m.tif -B L1m.tif  --calc="(B==-9999)*A + (B != -9999)*B" --outfile both.tiff --NoDataValue=-9999 --overwrite
3
  • seems like a good solution, however I have not managed to get the python scripts working, For gdal_calc i have issues with getting gdal_array (a script calc uses via gdalnumeric) to import properly into python.
    – SimonDeS
    Jan 18, 2016 at 11:07
  • CASE WHEN "LD_LiDAR_grnd_1m_merged@1" > -9999 THEN ="LD_LiDAR_grnd_1m_merged@1" WHEN = -9999 THEN ="LD_2mresamp_001@1" ELSE = -9999 END
    – SimonDeS
    Jan 18, 2016 at 13:25
  • I've tried using QGIS Raster calculator with the above statement as it can handle if statements. The result isn't what I had hoped but would it be possible to use this tool to conditionally write data from either of my grids into a new grid?
    – SimonDeS
    Jan 18, 2016 at 13:28

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.