[Qgis-user] Raster: replace a single value with another value

Carlos Cerdán sig.upagu at gmail.com
Mon Nov 17 09:38:52 PST 2014


Hi Andreas:

I think QGIS raster calculator can make this job. Conditional syntax is a
little bit... different.  The sentence that can do it is:

(TIFF=249)*255 + (TIFF<249)*TIFF + (TIFF>249)*TIFF

Where TIFF is your raster layer. The trick is: if the sentence in
parentheses is true, it gets value 1, else zero; so we have to multiply by
255 to replace the 249 values. Next we have to add the other values.

Good luck,

Carlos Cerdán

PD. Please let me know if i'm wrong with this suggestion



2014-11-17 12:02 GMT-05:00 Andreas Neumann <a.neumann at carto.net>:

> Hi,
>
> I have a very simple task (at least I thought it is simple), but am not
> able to do it properly.
>
> I have a grayscale tiff value where I would like to replace the value of
> 249 with 255 - all other values should stay as they are.
>
> I tried with gdal "nearblack", but nothing changed - I started a separate
> email-thread about that at the gdal list.
>
> Then I tried with the QGIS raster calculator - but it does not support
> conditional syntax.
>
> I tried with Processing and GRASS - but it would stop at 8% - the file is
> quite big.
>
> Finally I came across SAGA "Reclassify with grid value". The dialogue is
> very complicated and hard to understand. After a while it would stop with
> an error message telling me that Saga may not be properly configured - but
> it says that it is properly installed. Quite confusing ...
>
> I am trying on Win7 64bit.
>
> If the file wouldn't be so big I would try this task in The Gimp - where
> it is very simple to replace one pixel values with another - using "Select
> by color" and "fill with a specific color".
>
> Any idea how I could achieve my task with GDAL, QGIS, GRASS or Saga?
>
> Thanks,
> Andreas
>
>
> _______________________________________________
> Qgis-user mailing list
> Qgis-user at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-user
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20141117/f48b25f7/attachment.html>


More information about the Qgis-user mailing list