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

G. Allegri giohappy at gmail.com
Wed Nov 19 01:39:53 PST 2014


The problem with SAGA is that it loads eveything in memory to operate, and
I suspect it does it with raster import too.
SAGA works on its internal format, so you could try to convert the tiff to
SAGA format [1] with gdal_translate.

giovanni

[1] http://www.gdal.org/frmt_various.html#SAGA

2014-11-19 9:31 GMT+01:00 Andreas Neumann <a.neumann at carto.net>:

> Hi,
>
> Ok - now I installed a standalone SAGA 2.1.4 (64bit).
>
> I tried to use my bigger tiff file. When importing it I get the following
> message:
> http://webgis.uster.ch/temp/saga_error_message_file_is_abnormally_big.png
>
> My file is 200GB (Packbit compression), ranging between 60'000 and 70'000
> width/height. I don't think this is abnormally big.
>
> Is there another recommended file format besides TIFF that I should
> preferably use with SAGA?
>
> Maybe I should now switch mailing lists and ask this at the SAGA mail list
> ;-)
>
> Thanks,
>
> Andreas
>
> Am 2014-11-18 18:48, schrieb Michael Treglia:
>
>> Andreas,
>>
>> You're running 64bit SAGA, right? (if not sure, click the question
>> mark on the menu bar, and click "About" - should be towards the top).
>>
>> I actually like SAGA because I can throw pretty giant files at it.
>> Just to test out and make sure, I just loaded in a 10GB GeoTIFF with
>> integer values, and did a single value reclass that took about 3
>> minutes. You likely need ample RAM and disk space, but given that you
>> do, it should be feasible. [Watching the system resources, you can see
>> the respective amount of memory get taken up as you work with data in
>> SAGA]
>>
>> The 4GB limit seems like it could be a 32 bit issue.  I was using the
>> latest version of SAGA (2.1.3), 64 bit, downloaded from:
>> http://sourceforge.net/projects/saga-gis/files/SAGA%
>> 20-%202.1/SAGA%202.1.3/
>> [2]
>>
>> If you're really stuck and need to knock this task out of the way - if
>> you can get me the data I can do the reclass for you.
>>
>> hope that helps,
>> mike
>>
>> On Tue, Nov 18, 2014 at 10:04 AM, Andreas Neumann
>> <a.neumann at carto.net> wrote:
>>
>>  Hi Carlos,
>>>
>>> I reprojected to a different swiss projection system and the
>>> expression still does not work. I tested various projections,
>>> including UTM-32N. Very strange ...
>>>
>>> There clearly seems to be a bug in the raster calculator. I will
>>> open a bug with high priority.
>>>
>>> Thanks for testing and helping!
>>>
>>> Andreas
>>>
>>> Am 2014-11-18 15:36, schrieb Carlos Cerdán:
>>>
>>> Hi Andreas:
>>>
>>> It is solved: you have to reproject your TEMP layer. I've tried
>>> with
>>> UTM-32N zone and raster calculator works fine.
>>>
>>> Why raster calculator (and SAGA) doesn't work with your original
>>> CRS?
>>> Well, I don't know, perhaps devs group have the answer.
>>>
>>> It was a good challenge.
>>>
>>> Carlos
>>>
>>> 2014-11-18 4:37 GMT-05:00 Andreas Neumann <a.neumann at carto.net>:
>>>
>>> Hi Carlos,
>>>
>>> Thank you for your help!
>>>
>>> I tried with
>>>
>>> (TEMP at 1=249)*255 + (TEMP at 1<249)*TEMP at 1 + (TEMP at 1>249)*TEMP at 1
>>>
>>> My layer is called "temp". However, the resulting file contains all
>>> 0.
>>>
>>> I tried in both QGIS 2.4 and 2.6.
>>>
>>> Is there something wrong with the input file? It was generated from
>>> a PDF with ghostscript. Here is the metadata:
>>>
>>> -----
>>>
>>> GDAL provider
>>> GTiff
>>> GeoTIFF
>>> Datensatzbeschreibung
>>> //gis/gis/mapserverdata/uep/release_2014_11/temp.tif
>>> TIFFTAG_DATETIME=2014:11:17 09:50:08
>>> TIFFTAG_RESOLUTIONUNIT=2 (pixels/inch)
>>> TIFFTAG_SOFTWARE=GPL Ghostscript 9.10
>>> TIFFTAG_XRESOLUTION=600
>>> TIFFTAG_YRESOLUTION=600
>>> Kanal 1
>>> STATISTICS_MAXIMUM=255
>>> STATISTICS_MEAN=247.18714741724
>>> STATISTICS_MINIMUM=0
>>> STATISTICS_STDDEV=37.198102288306
>>> Dimensionen
>>> X: 71575 Y: 70867 Kanäle: 1
>>> Leerwert
>>> *Leerwert nicht gesetzt*
>>> Datentyp
>>> Byte - Acht Bit vorzeichenlose Ganzzahl
>>> Pyramidenübersichten
>>> Räumliches Bezugssystem des Layers
>>> +proj=somerc +lat_0=46.95240555555556 +lon_0=7.439583333333333
>>> +k_0=1 +x_0=600000 +y_0=200000 +ellps=bessel
>>> +towgs84=674.4,15.1,405.3,0,0,0,0 +units=m +no_defs
>>> Layerausdehnung (in urspünglicher Projektion des Layers)
>>> 0.0000000000000000,-70867.0000000000000000 :
>>> 71575.0000000000000000,0.0000000000000000
>>> Kanal
>>> Kanal 1
>>> Kanal Nr
>>> 1
>>> Keine Statistik
>>> Noch keine Statistik gesammelt
>>>
>>> ------------
>>>
>>> Thanks again if you have any idea what may be wrong with my file or
>>> the above listed raster calc statement.
>>>
>>> Andreas
>>>
>>> Am 2014-11-17 18:38, schrieb Carlos Cerdán:
>>>
>>> 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 [1] [1] [1]
>>>
>>> Links:
>>> ------
>>> [1] http://lists.osgeo.org/mailman/listinfo/qgis-user [1] [1]
>>>
>>> _______________________________________________
>>> Qgis-user mailing list
>>> Qgis-user at lists.osgeo.org
>>> http://lists.osgeo.org/mailman/listinfo/qgis-user [1] [1]
>>>
>>>  _______________________________________________
>>>  Qgis-user mailing list
>>>  Qgis-user at lists.osgeo.org
>>>  http://lists.osgeo.org/mailman/listinfo/qgis-user [1] [1]
>>>
>>> Links:
>>> ------
>>> [1] http://lists.osgeo.org/mailman/listinfo/qgis-user [1]
>>>
>>> _______________________________________________
>>> Qgis-user mailing list
>>> Qgis-user at lists.osgeo.org
>>> http://lists.osgeo.org/mailman/listinfo/qgis-user [1]
>>>
>>
>>  _______________________________________________
>>  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://sourceforge.net/projects/saga-gis/files/SAGA%
>> 20-%202.1/SAGA%202.1.3/
>>
> _______________________________________________
> Qgis-user mailing list
> Qgis-user at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-user
>



-- 
Giovanni Allegri
http://about.me/giovanniallegri
Twitter: https://twitter.com/_giohappy_
blog: http://blog.spaziogis.it
GEO+ geomatica in Italia http://bit.ly/GEOplus
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20141119/15d533ac/attachment.html>


More information about the Qgis-user mailing list