Re: [GRASS-user] r.mapcalculator and r.mapcalc

2017-02-21 Thread Luiz Andrade
Thank you very much!

In terms of best practices, if I work with several images with different
resolutions, should I always set the region resolution before executing
some raster calculation?
Or is it better to have different locations according to my images
resolutions?

Thanks again!

Regards!

2017-02-21 3:44 GMT-03:00 Markus Neteler :

>
> On Feb 21, 2017 1:34 AM, "Luiz Andrade"  wrote:
> >
> > Thanks!
> > Can you help me with another thing?
> > My images have 15m pixels, after processing in r.mapcalc and exporting
> they have 62m pixels. How can I solve this?
>
> You will need to set the
>
> https://grasswiki.osgeo.org/wiki/Computational_region
>
> correctly.
>
> Markus
>
___
grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user

Re: [GRASS-user] r.mapcalculator and r.mapcalc

2017-02-20 Thread Markus Neteler
On Feb 21, 2017 1:34 AM, "Luiz Andrade"  wrote:
>
> Thanks!
> Can you help me with another thing?
> My images have 15m pixels, after processing in r.mapcalc and exporting
they have 62m pixels. How can I solve this?

You will need to set the

https://grasswiki.osgeo.org/wiki/Computational_region

correctly.

Markus
___
grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user

Re: [GRASS-user] r.mapcalculator and r.mapcalc

2017-02-20 Thread Vaclav Petras
Hi Pedro,

On Mon, Feb 20, 2017 at 7:36 PM, Pedro Venâncio 
wrote:

> Hi Vaclav,
>
> The problem with r.mapcalc in QGIS was this one:
>
> https://hub.qgis.org/issues/6894
>
>
I forgot about this ticket. If I interpret the comments correctly there are
still people who want r.mapcalculator despite its issues.

I also forgot about -l flag to list inputs and outputs in G7.2:

r.mapcalc "a = elevation + lakes" -l
output=a
input=elevation@PERMANENT,lakes@PERMANENT

It does not do the computation, it only lists the inputs and outputs. The
was point to make writing the wrappers easier and more robust. See details
here:

https://grass.osgeo.org/grass72/manuals/r.mapcalc.html
https://trac.osgeo.org/grass/ticket/2592
https://trac.osgeo.org/grass/changeset/67000


> It was partially solved, but not completely. So, Victor had created a new
> raster calculator using native QGIS classes:
>
> https://github.com/qgis/QGIS/pull/3779
>

Thanks for the info.


>
>
> 2017-02-21 0:11 GMT+00:00 Vaclav Petras :
>
>>
>> On Mon, Feb 20, 2017 at 4:22 PM, Luiz Andrade 
>> wrote:
>>
>>> 1 - Why wasn’t r.mapcalculator ported to grass7? It is great to use it
>>> from within QGIS.
>>
>>
>> Nobody really asked for that as far as I know. The porting should be
>> quite simple if you are interested in that. But that was not the issue. See
>> discussion here:
>>
>> http://trac.osgeo.org/grass/ticket/2409#comment:187
>> http://trac.osgeo.org/grass/ticket/2409#comment:190
>>
>> QGIS seemed to focus more on providing good native QGIS calc:
>>
>> https://lists.osgeo.org/pipermail/qgis-developer/2016-October/045569.html
>> https://lists.osgeo.org/pipermail/qgis-developer/2016-October/045596.html
>>
>> Of course, these things can be reevaluated anytime. Ideally in a ticket.
>>
>> If you learn or ask more about it somewhere else, please write it back. I
>> would like to have the whole picture.
>>
>> Vaclav
>>
>> ___
>> grass-user mailing list
>> grass-user@lists.osgeo.org
>> https://lists.osgeo.org/mailman/listinfo/grass-user
>>
>
>
___
grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user

Re: [GRASS-user] r.mapcalculator and r.mapcalc

2017-02-20 Thread Pedro Venâncio
Hi Vaclav,

The problem with r.mapcalc in QGIS was this one:

https://hub.qgis.org/issues/6894

It was partially solved, but not completely. So, Victor had created a new
raster calculator using native QGIS classes:

https://github.com/qgis/QGIS/pull/3779

Best regards,
Pedro




2017-02-21 0:11 GMT+00:00 Vaclav Petras :

>
> On Mon, Feb 20, 2017 at 4:22 PM, Luiz Andrade 
> wrote:
>
>> 1 - Why wasn’t r.mapcalculator ported to grass7? It is great to use it
>> from within QGIS.
>
>
> Nobody really asked for that as far as I know. The porting should be quite
> simple if you are interested in that. But that was not the issue. See
> discussion here:
>
> http://trac.osgeo.org/grass/ticket/2409#comment:187
> http://trac.osgeo.org/grass/ticket/2409#comment:190
>
> QGIS seemed to focus more on providing good native QGIS calc:
>
> https://lists.osgeo.org/pipermail/qgis-developer/2016-October/045569.html
> https://lists.osgeo.org/pipermail/qgis-developer/2016-October/045596.html
>
> Of course, these things can be reevaluated anytime. Ideally in a ticket.
>
> If you learn or ask more about it somewhere else, please write it back. I
> would like to have the whole picture.
>
> Vaclav
>
> ___
> grass-user mailing list
> grass-user@lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/grass-user
>
___
grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user

Re: [GRASS-user] r.mapcalculator and r.mapcalc

2017-02-20 Thread Luiz Andrade
Thanks!
Can you help me with another thing?
My images have 15m pixels, after processing in r.mapcalc and exporting they 
have 62m pixels. How can I solve this?

Thanks again

Regards,
Luiz Claudio




> Em 20 de fev de 2017, à(s) 18:42, Helmut Kudrnovsky  escreveu:
> 
>> 1 - Why wasn’t r.mapcalculator ported to grass7? It is great to use it from
> within QGIS.
> 
> can't answer this one
> 
>> My r.mapcalc outputs int32 rasters (I want float32). Is there a way to
> choose the output type?
> 
> from the manual [1]
> 
> 
> [...]
> Functions
> The functions currently supported are listed in the table below. The type of
> the result is indicated in the last column. F means that the functions
> always results in a floating point value, I means that the function gives an
> integer result, and * indicates that the result is float if any of the
> arguments to the function are floating point values and integer if all
> arguments are integer. 
> 
> [...]
> Floating point values in the expression
> Floating point values in the expression are handled in a special way. With
> arithmetic and logical operators, if either operand is float, the other is
> converted to float and the result of the operation is float. This means, in
> particular that division of integers results in a (truncated) integer, while
> division of floats results in an accurate floating point value. With
> functions of type * (see table above), the result is float if any argument
> is float, integer otherwise.
> 
> Note: If you calculate with integer numbers, the resulting map will be
> integer. If you want to get a float result, add the decimal point to integer
> number(s).
> 
> If you want floating point division, at least one of the arguments has to be
> a floating point value. Multiplying one of them by 1.0 will produce a
> floating-point result, as will using float():
> 
>  r.mapcalc "ndvi = float(lsat.4 - lsat.3) / (lsat.4 + lsat.3)"
> [...]
> 
> 
> HTH
> 
> [1] https://grass.osgeo.org/grass73/manuals/r.mapcalc.html
> 
> 
> 
> -
> best regards
> Helmut
> --
> View this message in context: 
> http://osgeo-org.1560.x6.nabble.com/r-mapcalculator-and-r-mapcalc-tp5308738p5308742.html
> Sent from the Grass - Users mailing list archive at Nabble.com.
> ___
> grass-user mailing list
> grass-user@lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/grass-user

___
grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user

Re: [GRASS-user] r.mapcalculator and r.mapcalc

2017-02-20 Thread Luiz Andrade
Thank you very much!
That was very helpful!

Atenciosamente,
Luiz Claudio




> Em 20 de fev de 2017, à(s) 21:11, Vaclav Petras  
> escreveu:
> 
> 
> On Mon, Feb 20, 2017 at 4:22 PM, Luiz Andrade  > wrote:
> 1 - Why wasn’t r.mapcalculator ported to grass7? It is great to use it from 
> within QGIS.
> 
> Nobody really asked for that as far as I know. The porting should be quite 
> simple if you are interested in that. But that was not the issue. See 
> discussion here:
>  
> http://trac.osgeo.org/grass/ticket/2409#comment:187 
>  
> http://trac.osgeo.org/grass/ticket/2409#comment:190 
> 
> 
> QGIS seemed to focus more on providing good native QGIS calc:
> 
> https://lists.osgeo.org/pipermail/qgis-developer/2016-October/045569.html 
> 
> https://lists.osgeo.org/pipermail/qgis-developer/2016-October/045596.html 
> 
> 
> Of course, these things can be reevaluated anytime. Ideally in a ticket.
> 
> If you learn or ask more about it somewhere else, please write it back. I 
> would like to have the whole picture.
> 
> Vaclav

___
grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user

Re: [GRASS-user] r.mapcalculator and r.mapcalc

2017-02-20 Thread Vaclav Petras
On Mon, Feb 20, 2017 at 4:22 PM, Luiz Andrade  wrote:

> 1 - Why wasn’t r.mapcalculator ported to grass7? It is great to use it
> from within QGIS.


Nobody really asked for that as far as I know. The porting should be quite
simple if you are interested in that. But that was not the issue. See
discussion here:

http://trac.osgeo.org/grass/ticket/2409#comment:187
http://trac.osgeo.org/grass/ticket/2409#comment:190

QGIS seemed to focus more on providing good native QGIS calc:

https://lists.osgeo.org/pipermail/qgis-developer/2016-October/045569.html
https://lists.osgeo.org/pipermail/qgis-developer/2016-October/045596.html

Of course, these things can be reevaluated anytime. Ideally in a ticket.

If you learn or ask more about it somewhere else, please write it back. I
would like to have the whole picture.

Vaclav
___
grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user

Re: [GRASS-user] r.mapcalculator and r.mapcalc

2017-02-20 Thread Helmut Kudrnovsky
>1 - Why wasn’t r.mapcalculator ported to grass7? It is great to use it from
within QGIS.

can't answer this one

>My r.mapcalc outputs int32 rasters (I want float32). Is there a way to
choose the output type?

from the manual [1]


[...]
Functions
The functions currently supported are listed in the table below. The type of
the result is indicated in the last column. F means that the functions
always results in a floating point value, I means that the function gives an
integer result, and * indicates that the result is float if any of the
arguments to the function are floating point values and integer if all
arguments are integer. 

[...]
Floating point values in the expression
Floating point values in the expression are handled in a special way. With
arithmetic and logical operators, if either operand is float, the other is
converted to float and the result of the operation is float. This means, in
particular that division of integers results in a (truncated) integer, while
division of floats results in an accurate floating point value. With
functions of type * (see table above), the result is float if any argument
is float, integer otherwise.

Note: If you calculate with integer numbers, the resulting map will be
integer. If you want to get a float result, add the decimal point to integer
number(s).

If you want floating point division, at least one of the arguments has to be
a floating point value. Multiplying one of them by 1.0 will produce a
floating-point result, as will using float():

  r.mapcalc "ndvi = float(lsat.4 - lsat.3) / (lsat.4 + lsat.3)"
[...]


HTH

[1] https://grass.osgeo.org/grass73/manuals/r.mapcalc.html



-
best regards
Helmut
--
View this message in context: 
http://osgeo-org.1560.x6.nabble.com/r-mapcalculator-and-r-mapcalc-tp5308738p5308742.html
Sent from the Grass - Users mailing list archive at Nabble.com.
___
grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user

[GRASS-user] r.mapcalculator and r.mapcalc

2017-02-20 Thread Luiz Andrade
Hi there,
I have some questions regarding r.mapcalc questions:
1 - Why wasn’t r.mapcalculator ported to grass7? It is great to use it from 
within QGIS.
2 - My r.mapcalc outputs int32 rasters (I want float32). Is there a way to 
choose the output type?

Thanks!

Regards,
Luiz Claudio




___
grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user

[GRASS-user] r.mapcalculator / r.mapcalc not producing raster

2011-02-18 Thread jaydub

Hi all, I'm trying to combine two raster using the r.mapcalc/r.mapcalculator
but am getting no where. I'm using python. 

# I did this previously... so "dem" and "rain" exist as rasters
grass.run_command("r.in.gdal",input="/dem.tif",output="dem")
grass.run_command("r.in.gdal",input="/rain.tif",output="rain")

# Then I try this...
grass.run_command("r.mapcalculator",amap="dem",bmap="rain",formula="A *
B",outfile="test_combo")

The output from that gives me...
r.mapcalc "test_combo" = "( "dem" * "rain" )"
 100%
Done.

When I try to add "test_combo" to the display in GRASS, nothing shows, even
when I try to zoom to the layer in GRASS.

r.info gives me the following:
++
 | Layer:test_combo2Date: Fri Feb 18 13:19:52 2011   
|
 | Mapset:   PERMANENT  Login of Creator: jay
|
 | Location: newLocation 
|
 | DataBase: .  |
 | Title: ( test_combo )
|
 | Timestamp: none   
|

||
 |   
|
 |   Type of Map:  raster   Number of Categories: 255
|
 |   Data Type:FCELL 
|
 |   Rows: 20
|
 |   Columns:  20
|
 |   Total Cells:  400   
|
 |Projection: Lambert Conformal Conic
|
 |N: 707999.97864227S: 628766.19610209   Res: 3961.68912701  
|
 |E: 827306.35554785W: 607862.24148022   Res: 10972.20570338 
|
 |   Range of data:min = 0.00  max = 4241302.00  
|
 |   
|
 |   Data Description:   
|
 |generated by r.mapcalc 
|
 |   
|
 |   Comments:   
|
 |dem * rain 
|
 |   
|

++

-- 
View this message in context: 
http://osgeo-org.1803224.n2.nabble.com/r-mapcalculator-r-mapcalc-not-producing-raster-tp6041018p6041018.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] r.mapcalculator

2010-10-26 Thread Micha Silver


  
  
Hello

On 24/10/2010 19:29, ALT SHN wrote:

Regarding your first question, (convert floating point raster to
integer) you can use:
r.mapcalc "int_raster = int(fp_raster)

Hello
users,


I really could use some hints regarding this problem.


I want to generate a new raster from the following
  _expression_ (using r.mapcalculator from QGIS GRASS plugin):


A*0.5+B*0.05+C*0.2+D*0.2+E*0.05
  

All rasters are integer16 geotiff anda have the same
  resolution. I just get this message:


r.mapcalculator
ama...@permanent bma...@permanent cma...@permanent
dma...@permanent ema...@permanent =
formula=A*0.5+B*0.05+C*0.2+D*0.2+E*0.05 outfile=Erosao

  

Here, I think you want to skip the '@' character.
BTW, you can just run the above straight within r.mapcalc also:
r.mapcalc "Erosao = A*0.5 + B*0.05 + C*0.2 + D*0.2 +
  E*0.05"


  r.mapcalc
  "Erosao" = "( " "a...@permanent" @PERMANENT" *0.5+ "
  "b...@permanent" @PERMANENT" *0.05+ " "c...@permanent"
  @PERMANENT" *0.2+ " "d...@permanent" @PERMANENT" *0.2+ "
  "e...@permanent" @PERMANENT" *0.05)"
  Illegal
  filename. Character not allowed.
  
Invalid map
  Parse error
  
  
  Calculating Erosao. Try expert
mode.
  
Finished with error
  

  
I suspect something very basic is missing but I don´t know
what could it be!!
  

  Andre

  
  -- 
  ---
  Associação Leonel Trindade
  SOCIEDADE DE HISTÓRIA NATURAL
  
  Apartado 25 2564-909 Torres Vedras Portugal
  Sede e Biblioteca: rua Cavaleiros da Espora Dourada, 27A 2560
  Torres Vedras
  
  Laboratório de Paleontologia e Paleoecologia: Polígono Industrial
  do Alto do Ameal 2565-641 Ramalhal
  http://alt-shn.blogspot.com
  www.alt-shn.org
  
  This mail was received via Mail-SeCure System.
  

___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

This mail was received via Mail-SeCure System.






-- 
Micha Silver
http://www.surfaces.co.il/
Arava Development Co.  +972-52-3665918

  

___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


[GRASS-user] r.mapcalculator

2010-10-24 Thread ALT SHN
Hello users,

I really could use some hints regarding this problem.

I want to generate a new raster from the following expression (using
r.mapcalculator from QGIS GRASS plugin):

A*0.5+B*0.05+C*0.2+D*0.2+E*0.05

All rasters are integer16 geotiff anda have the same resolution. I just get
this message:

r.mapcalculator ama...@permanent bma...@permanent
cma...@permanentdmap=d@permanentema...@permanent=
formula=A*0.5+B*0.05+C*0.2+D*0.2+E*0.05 outfile=Erosao

r.mapcalc "Erosao" = "( " "a...@permanent" @PERMANENT" *0.5+ " "b...@permanent"
@PERMANENT" *0.05+ " "c...@permanent" @PERMANENT" *0.2+ " "d...@permanent"
@PERMANENT" *0.2+ " "e...@permanent" @PERMANENT" *0.05)"

Illegal filename. Character not allowed.

Invalid map

Parse error

Calculating Erosao. Try expert mode.

Finished with error


I suspect something very basic is missing but I don´t know what could it
be!!


Andre

-- 
---
Associação Leonel Trindade
SOCIEDADE DE HISTÓRIA NATURAL

Apartado 25 2564-909 Torres Vedras Portugal
Sede e Biblioteca: rua Cavaleiros da Espora Dourada, 27A 2560 Torres Vedras

Laboratório de Paleontologia e Paleoecologia: Polígono Industrial do Alto do
Ameal 2565-641 Ramalhal
http://alt-shn.blogspot.com
www.alt-shn.org
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user