0

I have a problem combining several rasters into one big raster. Particular annoying is, that I had this problem once before and solved it, but I can't remember how. Unfortunately the other StackExchange-Entries didn't help me either.

I try to combine a set of grayscale rasters using the function Raster>Miscellaneous>Merge. The problem is, that the outputraster always contains gaps, where the novalue areas of one raster overlap the value area of another layer. This Problem seems to appear no matter what settings I choose. Sometimes the merge-function creates an multicolor raster and tries to put the different input rasters into different colorbands. In any case I dont get the wanted result. Does anybody know this problem and remember how to get rid of it?

  • Did you assing the no_data value of the input bands, which appears as -n option in the command line calling gdal_merge? Otherwise gdal_merge simply overlays the images in the order they are given. – Kersten Jun 9 '15 at 13:54
  • Yes I tried this. It doesn't work with my data for some reason. I will try again at work tomorrow and upload some pictures. – akra-kachi Jun 11 '15 at 17:20
  • It doesn't work. When I start gdal_merge and load two of my rasters as input files, select 0 as No data value,and leave the rest of the options unticked, I get the following message: The process crashed some time after starting suvvessfully. QGIS doesn't give any further information on that, so I don't know, what is wrong. Any ideas? – akra-kachi Jun 12 '15 at 8:45
1

You can use gdal_translate -a_nodata <your_no_data_value> input.tif output.tif to get rid of the no_data values. In QGIS Raster>Conversions>Translate. After that you can build a vrt (Raster>Miscellaneous>Build Virtual Raster; gdalbuildvrt) or you can merge them. With the help of a vrt layer you can save any supported raster file format you want and you can use map extends (right-klick on layer and Save As).

E.g. using a Linux machine you can write a bash script when you have a lot of raster files.

  • Thanks for that advice. I will try out tomorrow and post the results. – akra-kachi Jun 11 '15 at 17:20
  • Ok that worked. I actually didn't use the Translate-Function but simply buildet an VRT. For some reason the no_data values were accepted here, while the same approach didn't work in the Merge-Function (see above). The generated VRT had a good resolution and I could save it as a GeoTiff (RAW) - so I got everything I wanted. Thanks a lot! – akra-kachi Jun 12 '15 at 13:03

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.