Ticket #3981 (closed enhancement: fixed)

Opened 2 years ago

Last modified 2 years ago

gdal_merge.py : add support for output of nodata value

Reported by: etiennesky Owned by: hobu
Priority: normal Milestone: 1.9.0
Component: Utilities Version: svn-trunk
Severity: normal Keywords:
Cc:

Description

The gdal_merge.py does not set the nodata value in the bands of the output file.

I have added a -a_nodata option (as in the other tools gdalwarp and gdal_translate), which adds the specified nodata value to the output file (regardless of the -a value).

+ if a_nodata is not None: + t_band.SetNoDataValue?(a_nodata)

Tested on GTIFF files only. I'd be glad to test other files types if necessary.

Attachments

diff-nodata.txt Download (4.0 KB) - added by etiennesky 2 years ago.
svn diff of file swig/python/scripts/gdal_merge.py

Change History

Changed 2 years ago by etiennesky

svn diff of file swig/python/scripts/gdal_merge.py

Changed 2 years ago by rouault

  • status changed from new to closed
  • resolution set to fixed
  • component changed from SWIG (all bindings) to Utilities
  • milestone set to 1.9.0

I've commited a more compact version of the proposed patch:

r22325 /trunk/gdal/ (apps/gdal_utilities.dox swig/python/scripts/gdal_merge.py): gdal_merge.py : add a -a_nodata option (#3981)

Note: See TracTickets for help on using tickets.