Hi Andreas:

I've checked the expression and it's ok. I forgot to warn about the "Actual
layer extension" button in raster calculator: When you have two or more
raster layers, and these have different limits, we have to indicate what
the limit of result is, so, if it's the case, in raster calculator, before
perform your expression, select the TEMP layer and press this button to
ensure that limit of resulting layer is right, else, you'll get a layer
containing all cells 0.

Or... start a new QGIS session, load just TEMP layer and use raster
calculator. Limits don't be an issue.

Regards

Carlos

2014-11-18 4:37 GMT-05:00 Andreas Neumann <a.neum...@carto.net>:

> Hi Carlos,
>
> Thank you for your help!
>
> I tried with
>
> (TEMP@1=249)*255 + (TEMP@1<249)*TEMP@1 + (TEMP@1>249)*TEMP@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.neum...@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@lists.osgeo.org
>>> http://lists.osgeo.org/mailman/listinfo/qgis-user [1]
>>>
>>
>>
>>
>> Links:
>> ------
>> [1] http://lists.osgeo.org/mailman/listinfo/qgis-user
>>
>> _______________________________________________
>> Qgis-user mailing list
>> Qgis-user@lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/qgis-user
>>
> _______________________________________________
> Qgis-user mailing list
> Qgis-user@lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-user
>
_______________________________________________
Qgis-user mailing list
Qgis-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-user

Reply via email to