* Moritz Lennert <[email protected]> [2017-05-30 18:00:59 +0200]:

Le Tue, 30 May 2017 17:34:59 +0200,
Nikos Alexandris <[email protected]> a écrit :

Dear community,

is it possible to concatenate raster pixel values using r.mapcalc
or/and existing modules?

Pixel values are numerical by definition, so I wouldn't think so.

It would be convenient, in some cases, I think. Think, somehow, of r.cross but
instead of assigning a new category value, a/the combination would be a
concatenation of the input (integers in this case, to make it simple)
raster values.


Something like the following examples

- expression = "product_20 = concatenate(20, input_map)":  a value of
88 in the "input_map" would mean the value 2088 (or 20088) in the
output "product_20" map.

Just find out what the highest value your input map and go to an order
of magnitude high enough to do this (i.e. if max(input_map)<100):

"expression = product20 = 2000 + input_map"

I've thought of that, as I have read it elsewhere. Yet, I rejected it
because I want to combine (maybe too) many maps together and still be
able to read fast the original values of the input maps.  Maybe I should
study it more.

Perhaps I should name the `input_map` in the examples more precisely,
say: input_map_20, input_map_25, et.c.

This is experimental work.  My actual goal is to retain all input values
from all input maps in as few as possible, or one if possible, map.

I was thinking of something like bit patterns, much like the QA bands of
Landsat products work, but it'd be perhaps more complicated to work
with.


- expression = "product_25 = concatenate(25, input_map)":  a value of
13 in the "input_map" would result in the value 2513 (or 25013) in
the output "product_25" map.

- expression = "product_nb = concatenate( product_20, product_25):
finally, the output pixel value, derived from the above examples,
would be "2008825013".

product_nb = product_20 * 10000 + product_25

?

I've found that I can play with the mapcalc's '@' operator, to get the
category labels assigned as raster values (when they are integers).

For example, the cat/label rules

0:
6:2006
13:20013
19:20019

would give a map with the labels in place of the cat values after

expression = "product_20 = @input_map_20"

If I repeat this for all of the different, yet similar, input maps, and,
then, combine again in the end the products... ?

Thank you Moritz, Nikos
_______________________________________________
grass-user mailing list
[email protected]
https://lists.osgeo.org/mailman/listinfo/grass-user

Reply via email to