[Qgis-user] Python script for QGIS

Ujaval Gandhi ujaval at spatialthoughts.com
Fri Dec 27 22:12:16 PST 2019


 <https://spatialthoughts.com/>
Try gdal_calc

gdal_calc.py -A input.tif --A_band=1 -B input.tif --B_band=2 -C input.tif
--C_band=3 -D input.tif --D_band=4 --outfile=reclass.tif
--calc="(A==109)*(B==178)*(C==200)*(D==255) +
(A==138)*(B==193)*(C==212)*(D==255) + (A==161)*(B==205)*(C==220)*(D==255)"

This will set the 3 RGB values to 1 and rest all to 0.

Ujaval Gandhi
Spatial Thoughts <https://spatialthoughts.com/>


On Fri, Dec 27, 2019 at 7:56 PM Nicolas Cadieux <
nicolas.cadieux at archeotec.ca> wrote:

> Hi,
> Yes, google “reclassify”. You can do it multiple ways.
> Nicolas
>
> > Le 27 déc. 2019 à 05:55, LE LAMER Romain <rlelamer at hotmail.fr> a écrit :
> >
> > Hi,
> > Is it possible via gdal_translate, or other gdal program, to binarize a
> tile?
> >
> > I would like the colors RGB 59,89,95,255 & 60,89,96,255  change to white
> (color entry 0) and that the other colors 109,178,200,255; 138,193,212,255
> & 161,205,220,255 change to black (color entry 1)
> >
> > I don't understand how to use the -b and / or -mask arguments in this
> code
> > l = 'gdal_translate -a_srs EPSG:4326 -a_ullr ' + ullr + f_in + f_out +
> '\n'
> >
> > Thanks
> > _______________________________________________
> > Qgis-user mailing list
> > Qgis-user at lists.osgeo.org
> > List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
> > Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
> _______________________________________________
> Qgis-user mailing list
> Qgis-user at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20191228/18c79721/attachment.html>


More information about the Qgis-user mailing list