<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div></div><div>Hi,</div><div><br></div><div>You may be able to do that with the Saga grid mosaic.  You can select ´max’ for overlapping areas.  </div><div><br></div><div><a href="http://www.saga-gis.org/saga_tool_doc/2.3.0/grid_tools_3.html">http://www.saga-gis.org/saga_tool_doc/2.3.0/grid_tools_3.html</a></div><div><br></div><div> Nicolas</div><div><br>Le 17 nov. 2017 à 15:05, Rousseau Lambert2, Louis-Philippe (EC) <<a href="mailto:louis-philippe.rousseaulambert2@canada.ca">louis-philippe.rousseaulambert2@canada.ca</a>> a écrit :<br><br></div><blockquote type="cite"><div><span>Hi everyone,</span><br><span></span><br><span>I would like to have your opinion on some processing I have to do. </span><br><span></span><br><span>So I have to merge many rasters (eventually more then 50). Some overlaps</span><br><span>(never completely), but others don't, my files when merged cover Canada.</span><br><span>I have to keep the maximum value where there is some overlap between</span><br><span>different files.</span><br><span></span><br><span>My first try was to use gdal_calc with --calc="maximum(A,B)", but it can</span><br><span>only input 26 files at a time. And The output of gdal_calc is only the</span><br><span>region of overlap, in my case I have to keep the whole extent of my</span><br><span>rasters, not only the region of overlap... Is there a way I could use</span><br><span>gdal_calc and keep everything, not only the overlap?</span><br><span></span><br><span>My second try was to use gdalwarp with a vrt of all my files as input</span><br><span>and use -r max for my resampling. My results were that it only</span><br><span>overlapped my geotiff and did not took the maximum value.</span><br><span></span><br><span>My last try, was to use gdalwarp to ensure that all my files have the</span><br><span>same extent and that pixel overlap perfectly. Then I create a mosaic</span><br><span>using gdal_merge of all my rasters. At this point I don't manage yet the</span><br><span>maximum value. Then I loop trough all my geotiff using gdal_calc to</span><br><span>output the overlap region between one geotiff and my mosaic. then I can</span><br><span>merge the overlap region with my mosaic. Finally I get a mosaic of the</span><br><span>maximum value where my raster overlap.</span><br><span></span><br><span>I don't really like this solution because if I have 50 files, I have to</span><br><span>use gdal_calc 50 times and merge the result 50 times... That seems a lot</span><br><span>of processing to simply get the maximum value in a mosaic.</span><br><span></span><br><span>Can you think of a better way to do? Any thoughts or opinions are welcome!</span><br><span></span><br><span>Louis-Philippe R. Lambert</span><br><span></span><br><span>_______________________________________________</span><br><span>gdal-dev mailing list</span><br><span><a href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a></span><br><span><a href="https://lists.osgeo.org/mailman/listinfo/gdal-dev">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a></span></div></blockquote></body></html>