2

I have a couple of large sets of imagery I need to mosaic using GDAL. The sets are currently in tiff format with 18 tiles totaling about 20gb in size. I have attempted to mosaic using both the gdal_merge.py and gdalwarp utilities. The results are either a completely black raster or only white pixels where the image should be. Does anyone know how to prevent this from happening? Looking over the documentation I did not see any parameters that I thought would make a difference, but am I missing one?

I also attempted the same process with the same images in PNG format, and got the same results using this command:

gdal_merge.py -o mosaic.tif Baton_Rouge_01.png Baton_Rouge_02.png Baton_Rouge_03.png Baton_Rouge_04.png Baton_Rouge_05.png Baton_Rouge_06.png 
Baton_Rouge_07.png Baton_Rouge_08.png Baton_Rouge_09.png Baton_Rouge_10.png Baton_Rouge_11.png Baton_Rouge_12.png Baton_Rouge_13.png Baton_Rouge_14.png 
Baton_Rouge_15.png Baton_Rouge_16.png Baton_Rouge_17.png Baton_Rouge_18.png

Edit:

I am not using QGIS, I am attempting to complete this processing using the GDAL cmd line utilities. I tried the gdalbuildvrt utility then pulled the vrt into arcmap for viewing. The result looked like this:

Using this command:

gdalbuildvrt -input_file_list list.txt test.vrt

The white area should be RGB image.

enter image description here

  • 2
    Use GDALBuildVRT to bring the rasters together quickly (can be viewed in Esri or QGIS - possibly others but I can't comment on that) and then GDAL_Translate to mosaic into a single file when you're happy with how it looks. How does your NoData areas look? If you don't have any it should be sweet. – Michael Stimson Aug 31 '15 at 2:33
  • 2
    Are your images georeferenced? Show gdalinfo report about one image. And do they look like a mosaic you want to get if you open them all as separate layers with QGIS? – user30184 Aug 31 '15 at 4:25
  • Have you tried to see if you actually have values in the white area? Could be a matter of stretching. – Mikkel Lydholm Rasmussen Aug 31 '15 at 10:56
  • They images are georeferenced, and when I look at the pixels in the white area it shows values for all three bands that are consistent with RGB imagery. I cannot get it to show color though. – Michael B Aug 31 '15 at 11:16
  • 1
    And which software are you using to show the data? – Mikkel Lydholm Rasmussen Aug 31 '15 at 11:31
2

You can set the GDAL_MERGE process up with QGIS using the GUI and that might be a good way to start testing.

Also, test on two tiles that are next to each other first.

I reckon it's something to do with NODATA. Please post your command in your question so that we can see how you're achieving the merge.

  • 2
    That works well, but if you're experiencing difficulty the VRT method allows for a quick preview of the final result. I like the idea of doing two (adjacent) tiles first to try to error check. – Michael Stimson Aug 31 '15 at 3:23
  • 1
    After including some of the no data parameters in the command, I am able to see the RGB values. I assumed these parameters were not required, but maybe they are. Thanks for the help. – Michael B Aug 31 '15 at 15:24
0

Just came across this post while searching for something else. Wanted to confirm that the NODATA values should be included in the command. Otherwise your colormap is likely to be stretched from 0 to a very large number (which is used as NODATA value). So for an RGB image all of your values are basically scaled back with that large number and rounded to zero in an 8 bit integer image.

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.