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

Andreas Neumann a.neumann at carto.net
Tue Nov 18 05:40:20 PST 2014


Hi,

Turns out my issue is actually a file-size issue. The SAGA and GRASS 
methods to replace the value work fine on smaller files, but as soon as 
I go beyond 4GB, the methods fail.

Probably due to the fact that QGIS processing is not creating BIGTIFF 
files?

Are there alternative raster formats where the 4GB limit does not apply 
or can I force the QGIS processing to use the BIGTIFF option?

BTW: the method with the QGIS raster calculator did not work - not even 
on the small file. I don't know why. I used the formula:

(temp_test at 1=249)*255 + (temp_test at 1<249)*temp_test at 1 + 
(temp_test at 1>249)*temp_test at 1

and the result is all zeros ;-(

If you want to try with the QGIS raster calculator and a smaller file - 
here is the file I tested with:
http://webgis.uster.ch/temp/temp_test.tif

Thank you if you have ideas how to overcome the 4GB limit with the 
SAGA/GRASS method or if you can help me fix my formula in the QGIS 
raster calculator.

Andreas



Am 2014-11-18 12:15, schrieb Andreas Neumann:
> Hi Michael,
> 
> Thank you for your reply.
> 
> I tried now in Saga directly, where the UI seems to be easier than in
> QGIS processing. When I start it, I get a "Module caused access
> violation" after about 10 seconds.
> 
> Here are the settings I used:
> http://webgis.uster.ch/temp/saga_reclass_settings.png
> 
> Maybe the image is too big? Width and height are each > 70000 pixels.
> 
> Are there any size limitations? Or settings to improve memory usage?
> 
> Thanks,
> Andreas
> 
> Am 2014-11-17 18:19, schrieb Michael Treglia:
>> Hi Andreas,
>> 
>> Strange that you're having this error - for simple reclassifications,
>> SAGA is typically what I use (I agree it seems complicated and tough
>> to understand)
>> 
>> Not sure if it will be useful for you, but I've got an example in a
>> tutorial I produced here (as a PDF - the raster reclassify starts on
>> page 30).
>> http://mltconsecol.github.io/QGIS-Tutorial/QGIS-Tutorial/Treglia_OSOS%20Notes_V1.01.pdf
>> [2], though the example is for a "Simple Table", to reclassify a bunch
>> of values.
>> 
>> For your problem, I would just chose the method "Single", setting your
>> old value and new values appropriately, and make sure to uncheck the
>> box to "replace other values". 
>> 
>> Are you exporting to a file? Or to a temp file?
>> 
>> Also, this is do-able in R; if you want to give that a shot, write
>> back and I'll send some instructions [need to re-look up my method for
>> that... its been a little while].
>> 
>> Hope that helps,
>> Mike
>> 
>> On Mon, Nov 17, 2014 at 11:02 AM, Andreas Neumann
>> <a.neumann at carto.net> wrote:
>> 
>>> 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 [1]
>> 
>> 
>> 
>> Links:
>> ------
>> [1] http://lists.osgeo.org/mailman/listinfo/qgis-user
>> [2]
>> http://mltconsecol.github.io/QGIS-Tutorial/QGIS-Tutorial/Treglia_OSOS%20Notes_V1.01.pdf
> _______________________________________________
> Qgis-user mailing list
> Qgis-user at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-user



More information about the Qgis-user mailing list