[gdal-dev] Cropping a raster by a polygon - only nodata outside polygon wanted

Jukka Rahkonen jukka.rahkonen at maanmittauslaitos.fi
Wed Jan 14 10:25:31 PST 2015


mathieu <mathieu.rajerison <at> gmail.com> writes:


> Is there a simple way to find one or several pixel value none of the bands 
use ?

Hi,

Another GDAL users just some time ago told about a workaround for a little
bit similar use case. The idea is to use first gdal_calc.py and update all
(0,0,0) pixels into (1,1,1). Because of this little trick it is guaranteed
that after runninig a process that generates (0,0,0) as nodata pixels, all
that is (0,0,0) in the image comes from this process. For the users the
(1,1,1) pixels of real data look just as black as they used to.

-Jukka Rahkonen-







More information about the gdal-dev mailing list