[GRASS-user] r.mapcalc error

dear all,

I got an error message when i try to mosaic images :

Mosaicing 2 images…
syntax error, unexpected INTEGER, expecting VARNAME or NAME
Parse error
ERROR: parse error
ERROR: An error occurred while running r.mapcalc

the syntax error is also appeared when i try to execute r.mapcalc, both using GUI and terminal. Seems the error occurred after i upgraded grass from 7.0.3 to 7.0.4. I hope someone can help, thank you in advance

Andry

andry rustanto-2 wrote

dear all,
I got an error message when i try to mosaic images :
Mosaicing 2 images...
syntax error, unexpected INTEGER, expecting VARNAME or NAME
Parse error
ERROR: parse error
ERROR: An error occurred while running r.mapcalc

the syntax error is also appeared when i try to execute r.mapcalc, both
using GUI and terminal. Seems the error occurred after i upgraded grass
from 7.0.3 to 7.0.4. I hope someone can help, thank you in advance
Andry

what is the used r.mapcalc command?

-----
best regards
Helmut
--
View this message in context: http://osgeo-org.1560.x6.nabble.com/r-mapcalc-error-tp5285649p5285653.html
Sent from the Grass - Users mailing list archive at Nabble.com.

Hi Helmut,

the r.mapcalc error i found at the first time when i try to mosaic two images. Then I try r.mapcalc in another operation, for example :

r.mapcalc “image 1 = if( NDVI@220215 >= 0.25 ,1 ,0)”
syntax error, unexpected INTEGER, expecting ‘(’
Parse error
ERROR: parse error

regards,

Andry

On Tuesday, September 13, 2016 9:35 PM, Helmut Kudrnovsky hellik@web.de wrote:

andry rustanto-2 wrote

dear all,
I got an error message when i try to mosaic images :
Mosaicing 2 images…
syntax error, unexpected INTEGER, expecting VARNAME or NAME
Parse error
ERROR: parse error
ERROR: An error occurred while running r.mapcalc

the syntax error is also appeared when i try to execute r.mapcalc, both
using GUI and terminal. Seems the error occurred after i upgraded grass
from 7.0.3 to 7.0.4. I hope someone can help, thank you in advance
Andry

what is the used r.mapcalc command?


best regards
Helmut

View this message in context: http://osgeo-org.1560.x6.nabble.com/r-mapcalc-error-tp5285649p5285653.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

Hei Andy,

You have a whitespace in your mapname, wich is not valid. I am surprised that a mapset name with only numbers is allowed…

The rest looks OK.

Try:

r.mapcalc expression=“image1=if( NDVI@220215 >= 0.25 ,1 ,0)”

instead.

Cheers

Stefan

···

From: grass-user [mailto:grass-user-bounces@lists.osgeo.org] On Behalf Of andry rustanto
Sent: 13. september 2016 21:53
To: grass-user@lists.osgeo.org
Subject: Re: [GRASS-user] r.mapcalc error

Hi Helmut,

the r.mapcalc error i found at the first time when i try to mosaic two images. Then I try r.mapcalc in another operation, for example :

r.mapcalc “image 1 = if( NDVI@220215 >= 0.25 ,1 ,0)”
syntax error, unexpected INTEGER, expecting ‘(’
Parse error
ERROR: parse error

regards,

Andry

On Tuesday, September 13, 2016 9:35 PM, Helmut Kudrnovsky <hellik@web.de> wrote:

andry rustanto-2 wrote

dear all,
I got an error message when i try to mosaic images :
Mosaicing 2 images…
syntax error, unexpected INTEGER, expecting VARNAME or NAME
Parse error
ERROR: parse error
ERROR: An error occurred while running r.mapcalc

the syntax error is also appeared when i try to execute r.mapcalc, both
using GUI and terminal. Seems the error occurred after i upgraded grass
from 7.0.3 to 7.0.4. I hope someone can help, thank you in advance
Andry

what is the used r.mapcalc command?


best regards
Helmut

View this message in context: http://osgeo-org.1560.x6.nabble.com/r-mapcalc-error-tp5285649p5285653.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

On Tue, Sep 13, 2016 at 9:23 PM, andry rustanto <arus_81@yahoo.com> wrote:

dear all,

I got an error message when i try to mosaic images :

Mosaicing 2 images...
syntax error, unexpected INTEGER, expecting VARNAME or NAME
Parse error
ERROR: parse error
ERROR: An error occurred while running r.mapcalc

the syntax error is also appeared when i try to execute r.mapcalc, both
using GUI and terminal. Seems the error occurred after i upgraded grass from
7.0.3 to 7.0.4. I hope someone can help, thank you in advance

A user got the same problem last year, in the end it was the usage or
a restricted character in location/mapset name.
Please see

https://lists.osgeo.org/pipermail/grass-user/2015-November/073382.html
(esp. the second part of that email).

Markus

r.mapcalc "image 1 = if( NDVI@220215 >= 0.25 ,1 ,0)"
syntax error, unexpected INTEGER, expecting '('

is there a whitespace between "image" and "1"?

try image1 instead of image 1.

-----
best regards
Helmut
--
View this message in context: http://osgeo-org.1560.x6.nabble.com/r-mapcalc-error-tp5285649p5285664.html
Sent from the Grass - Users mailing list archive at Nabble.com.

Helmut Kudrnovsky wrote

r.mapcalc "image 1 = if( NDVI@220215 >= 0.25 ,1 ,0)"
syntax error, unexpected INTEGER, expecting '('

is there a whitespace between "image" and "1"?

try image1 instead of image 1.

just tried it here:

r.mapcalc expression=image 1 = elevation@PERMANENT
syntax error, unexpected INTEGER, expecting '('
Parse error
ERROR: parse error

white spaces are not allowed in layer names.

-----
best regards
Helmut
--
View this message in context: http://osgeo-org.1560.x6.nabble.com/r-mapcalc-error-tp5285649p5285665.html
Sent from the Grass - Users mailing list archive at Nabble.com.

On Tue, Sep 13, 2016 at 10:14 PM, Helmut Kudrnovsky <hellik@web.de> wrote:

white spaces are not allowed in layer names.

Yep, not allowed. See also

https://grasswiki.osgeo.org/wiki/Location_and_Mapsets#Mapset_name_related_user_questions

Markus

Dear All,

Thanks for all your corrections, indeed i made mistakes in mapset name (only use numbers without any characters) and whitespace in the new map name. Now its solved, thanks again.

regards,

Andry

On Tuesday, September 13, 2016 10:13 PM, Helmut Kudrnovsky hellik@web.de wrote:

r.mapcalc “image 1 = if( NDVI@220215 >= 0.25 ,1 ,0)”
syntax error, unexpected INTEGER, expecting ‘(’

is there a whitespace between “image” and “1”?

try image1 instead of image 1.


best regards
Helmut

View this message in context: http://osgeo-org.1560.x6.nabble.com/r-mapcalc-error-tp5285649p5285664.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

Hi,

Same problem.

Solution is to eliminate the reference to the mapset (i.e. MyMap@mapset -->
MyMap )

--
View this message in context: http://osgeo-org.1560.x6.nabble.com/r-mapcalc-error-tp5285649p5303144.html
Sent from the Grass - Users mailing list archive at Nabble.com.