[GRASS-user] Re: Values from multiple raster -
Glynn Clements wrote: The same result can be achieved with one command: r.mapcalc output = A * 1.0 + B The multiply will cause A to be converted to double to match the other argument (floating-point constants are double unless an explicit f suffix is given), the multiply will yield a double result, and the addition will convert B to double to match this. perfect, I tried it and it actually works:) This speeds up operations. Now I have to combine new maps and then to reclassify the maps, I will use r.recode ... we'll see what happens:) Thank you Glynn Gabriele -- View this message in context: http://osgeo-org.1803224.n2.nabble.com/Values-from-multiple-raster-to-link-together-tp5741032p5772145.html Sent from the Grass - Users mailing list archive at Nabble.com. ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user
[GRASS-user] Re: Values from multiple raster -
Hy Daniel. I do not think that r.cross can solve the problem. With r.cross I could get a concatenation of label: For example, with values A = 12 B = 3323 C = 1 the result with the label category 12, category 3323, category 1 However, if you know a chance I can prove otherwise. As a result, the value of cell in the raster output should be 12332301 Ciao Gabriele -- View this message in context: http://osgeo-org.1803224.n2.nabble.com/Values-from-multiple-raster-to-link-together-tp5741032p5766350.html Sent from the Grass - Users mailing list archive at Nabble.com. ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user
Re: [GRASS-user] Re: Values from multiple raster -
Ok, I misunderstood your problem. You want the concatenated values, not just the map of the different crossings. Maybe use r.cross and then some grep magic in the raster category file Daniel On Tue, Nov 23, 2010 at 10:02 AM, Gabriele N. gis...@libero.it wrote: Hy Daniel. I do not think that r.cross can solve the problem. With r.cross I could get a concatenation of label: For example, with values A = 12 B = 3323 C = 1 the result with the label category 12, category 3323, category 1 However, if you know a chance I can prove otherwise. As a result, the value of cell in the raster output should be 12332301 Ciao Gabriele -- View this message in context: http://osgeo-org.1803224.n2.nabble.com/Values-from-multiple-raster-to-link-together-tp5741032p5766350.html Sent from the Grass - Users mailing list archive at Nabble.com. ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user
[GRASS-user] Re: Values from multiple raster -
yes, maybe with grep and r.cross ... but then you think you can convert the result of r.cross as cell value? Gabriele -- View this message in context: http://osgeo-org.1803224.n2.nabble.com/Values-from-multiple-raster-to-link-together-tp5741032p5766761.html Sent from the Grass - Users mailing list archive at Nabble.com. ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user
[GRASS-user] Re: Values from multiple raster -
I have a new problem, this time I would like to concatenate two maps A and B. A is with 8 digits, B is with 4 digits. So I do as usual: r.mapcalc output = (( A * 1) ( B )) But I get strange values with negative values. I did several tests but without resolve. Perhaps r.mapcalc may have problems with numbers greater than 10 digits Thanks Gabriele -- View this message in context: http://osgeo-org.1803224.n2.nabble.com/Values-from-multiple-raster-to-link-together-tp5741032p5767794.html Sent from the Grass - Users mailing list archive at Nabble.com. ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user
Re: [GRASS-user] Re: Values from multiple raster -
It's not r.mapcalc fault. I imagine it's probably a limitation due to the number of bits in your image. For instance, 8 bit images can have up to 256 values. 16 bit images can have 65,535. So, if you have too many values, you will have problems. Not sure how to avoid this in your case but, maybe you will need to work with categories after all. Are you planing on doing any math operations in the concatenated values or is it more for displaying pourposes? Cheers Daniel http://en.wikipedia.org/wiki/Integer_(computer_science) On Tue, Nov 23, 2010 at 4:34 PM, Gabriele N. gis...@libero.it wrote: I have a new problem, this time I would like to concatenate two maps A and B. A is with 8 digits, B is with 4 digits. So I do as usual: r.mapcalc output = (( A * 1) ( B )) But I get strange values with negative values. I did several tests but without resolve. Perhaps r.mapcalc may have problems with numbers greater than 10 digits Thanks Gabriele -- View this message in context: http://osgeo-org.1803224.n2.nabble.com/Values-from-multiple-raster-to-link-together-tp5741032p5767794.html Sent from the Grass - Users mailing list archive at Nabble.com. ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user
[GRASS-user] Re: Values from multiple raster -
Hy Glynn. Thanks for the interesting explanation. I did then so: r.mapcalc A_new = (double(A)) and r.mapcalc B_new = (double(B)) and then r.mapcalc output = ((A_new * 1)+(B_new )) I need to check the result, but it seems that the result is right. Thank you very much Gabriele -- View this message in context: http://osgeo-org.1803224.n2.nabble.com/Values-from-multiple-raster-to-link-together-tp5741032p5768432.html Sent from the Grass - Users mailing list archive at Nabble.com. ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user
[GRASS-user] Re: Values from multiple raster -
Daniel Victoria wrote: It's not r.mapcalc fault. I imagine it's probably a limitation due to the number of bits in your image. For instance, 8 bit images can have up to 256 values. 16 bit images can have 65,535. So, if you have too many values, you will have problems. Not sure how to avoid this in your case but, maybe you will need to work with categories after all. Are you planing on doing any math operations in the concatenated values or is it more for displaying pourposes? Hi Daniel... Maybe it would be useful only concatenation but I would also have the possibility to apply tools such as r.statistics and other similar that work on the value of cells. Gabriele -- View this message in context: http://osgeo-org.1803224.n2.nabble.com/Values-from-multiple-raster-to-link-together-tp5741032p5768618.html Sent from the Grass - Users mailing list archive at Nabble.com. ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user
Re: [GRASS-user] Re: Values from multiple raster -
Gabriele N. wrote: Thanks for the interesting explanation. I did then so: r.mapcalc A_new = (double(A)) and r.mapcalc B_new = (double(B)) and then r.mapcalc output = ((A_new * 1)+(B_new )) The same result can be achieved with one command: r.mapcalc output = A * 1.0 + B The multiply will cause A to be converted to double to match the other argument (floating-point constants are double unless an explicit f suffix is given), the multiply will yield a double result, and the addition will convert B to double to match this. -- Glynn Clements gl...@gclements.plus.com ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user
Re: [GRASS-user] Re: Values from multiple raster - to link together
I'm coming in a bit late in the discussion but doesn't r.cross solves your problem? http://grass.osgeo.org/grass65/manuals/html65_user/r.cross.html Daniel On Tue, Nov 16, 2010 at 2:51 PM, Gabriele N. gis...@libero.it wrote: Sorry, I have not explained well. The problem was related to the value of C map. That is, I take the example above. If the value of C map is equal to 1, I get a result - A =12 B=3323 C=1 =12332301 (8 digit number) and instead could be useful 1233231 (number 7-digit). However I checked and I need a value to 8 digits . so ok:) Thank you very much Gabriele -- View this message in context: http://osgeo-org.1803224.n2.nabble.com/Values-from-multiple-raster-to-link-together-tp5741032p5744524.html Sent from the Grass - Users mailing list archive at Nabble.com. ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user
[GRASS-user] Re: Values from multiple raster - to link together
Sorry, I have not explained well. The problem was related to the value of C map. That is, I take the example above. If the value of C map is equal to 1, I get a result - A =12 B=3323 C=1 =12332301 (8 digit number) and instead could be useful 1233231 (number 7-digit). However I checked and I need a value to 8 digits . so ok:) Thank you very much Gabriele -- View this message in context: http://osgeo-org.1803224.n2.nabble.com/Values-from-multiple-raster-to-link-together-tp5741032p5744524.html Sent from the Grass - Users mailing list archive at Nabble.com. ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user
[GRASS-user] Re: Values from multiple raster - to link together
Excellent Alex:). The maps are as follows: A - value 0, 1, 2, ... 19 B - value 0, 1001, 1002, 1003 3351 C - value from 0, 1, 2, 3, 4 .. 15 So, I did as you suggested: r.mapcalc output = (( A *100)+( B *100)+ C ) right? And if I had decimal numbers or strings instead of numbers? Thanks Gabriele -- View this message in context: http://osgeo-org.1803224.n2.nabble.com/Values-from-multiple-raster-to-link-together-tp5741032p5741794.html Sent from the Grass - Users mailing list archive at Nabble.com. ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user
Re: [GRASS-user] Re: Values from multiple raster - to link together
Am 15.11.2010 23:10, schrieb Gabriele N.: Excellent Alex:). The maps are as follows: A - value 0, 1, 2, ... 19 B - value 0, 1001, 1002, 1003 3351 C - value from 0, 1, 2, 3, 4 .. 15 So, I did as you suggested: r.mapcalc output = (( A *100)+( B *100)+ C ) right? And if I had decimal numbers or strings instead of numbers? Thanks Gabriele Strings in a raster map? With decimal numbers it works the same way. Or you multiply the map with number of digits and handle it as an integer map (maybe that does not work because of limited bit information per pixel). Achim ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user
Re: [GRASS-user] Re: Values from multiple raster - to link together
Am 15.11.2010 23:36, schrieb Gabriele N.: Hi Achim. Returning to the problem of the three maps in some cases remain the problem (for example for the map C), because some numbers are 2 digits and another with 1 digit. For example, with values A = 12 B = 3323 C = 1 instead of 1233231 I have 12332301 :/ Sorry, but I dont understand the problem. How do you know the origin number later when eg C has sometimes length 1 and sometimes more? ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user