I have been trying with no luck to merge forest canopy rasters available through the NLCD (e.g. Grids 102 and 105) using QGIS in Mac (as well as R, and SAGA in Windows).

The GeoTIFF grids import and display fine. However, when I try to merge the two, triangular black spaces appear around the edges of each, and where they overlap the zero/null values of one are superimposed on the actual values of the other. It looks like this:

projection edge overlap error in merge

I suspect this is a projection problem, as the grids do not align with their mutual boundary. The files import with a "user defined" projection that is similar to NAD83/Conus Albers (EPSG:5070).

I have tried straight merging, and re-projecting before merging to various projections, but nothing seems to work. Strangely enough, however, the "land cover" (as opposed to "forest canopy") GeoTIFF rasters provided by the NLCD corresponding to the same areas - and with the same projection - merge without issue.

How can I perform a proper merge with these rasters?


Try to check No data value = Zero, and see if that succeed, as shown below

If it is not zero, then replace the zero pixel value with value of pixel. enter image description here

Another option, would be to go to the Transparency tab, and add 0 as an Additional no data value or the pixel value of it is not Zero.

enter image description here

  • Thank you ahmandhanb - unfortunately that does not seem to change the outcome. Apr 8 '16 at 6:55
  • I added additional details. Hope it can solve your problem.
    – ahmadhanb
    Apr 8 '16 at 7:16
  • Still no luck. Note that in your first suggestion, if I leave the "No data value = 0" option unchecked, I get the same result but with only black background. Could the issue be with the projection? It seems the rasters are being forced into a frame that requires these large, unnecessary triangular borders. Thank you again for your suggestions. Apr 8 '16 at 7:50
  • Ok! It was the no data value after all. Setting "No data value = 255" works fine. Thanks also to AndreJ for the insight that the null data was stored with a value of 255. Apr 8 '16 at 8:09
  • Glad it worked. The issue that you have is most likely related to No data rather than the projection. Once you know the correct pixel value of No data, it should solve the problem. Thanks to AndreJ for giving the hint of the correct pixel value.
    – ahmadhanb
    Apr 8 '16 at 8:13

The original canopy rasters have a nodata value of 255 ( not zero) outside of the exact 3-degree extent. You can check that with gdalinfo on command line, or inside QGIS with Rightclick on the layer -> Properties, Metadata tab, Properties section.

So it works for me with:

gdal_merge.bat -n 255 -a_nodata 255 -of GTiff -o F:/Karten/Geotiff/NLCD/out.tif F:/Karten/Geotiff/NLCD/NLCD2011_CAN_N42W105.tif F:/Karten/Geotiff/NLCD/NLCD2011_CAN_N39W105.tif F:/Karten/Geotiff/NLCD/NLCD2011_CAN_N39W102.tif

enter image description here

Qgis crashes at some stage during merging, but the same command line works inside the OSGEO4W shell.

The Landcover files have no areas of nodata, they simply overlap:

enter image description here

  • This is great, thank you AndreJ. The fact that the null values are stored at 255, combined with ahmandhanb's suggestion, is enough. (I chose that answer as it's the simplest solution for a rookie like myself.) Apr 8 '16 at 8:11

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.