Hello,
I'm new to GRASS and programming and I'm trying to learn Grass shell
programming and developing a small code help me automate my work.
I'm doing this tutorial grasswiki.osgeo.org/wiki/Shell_scripting and have
already run into a problem (which, early in a tutorial is rather annoying)
When I try to run this
map=$1
g.message message="Setting computational region to map <$map>"
g.region rast=$map
d.erase
d.rast $map
exit 0
Grass tells me it cannot find the map. But I don't even know where exactly I
put the name of the file is it
map=$name_of_raster or map=name_of_raster.
Does someone have the answer?
--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Basic-problem-with-defining-parameter-tp5166498.html
Sent from the Grass - Users mailing list archive at Nabble.com.
On 08/10/14 16:00, adamhoff wrote:
Hello,
I'm new to GRASS and programming and I'm trying to learn Grass shell
programming and developing a small code help me automate my work.
I'm doing this tutorial grasswiki.osgeo.org/wiki/Shell_scripting and have
already run into a problem (which, early in a tutorial is rather annoying)
This page is not really a tutorial, but an information page about how to do shell scripting with GRASS. A minimum of knowleddge about shell scripting is probably a pre-requisite for understanding the examples.
When I try to run this
map=$1
g.message message="Setting computational region to map <$map>"
g.region rast=$map
d.erase
d.rast $map
exit 0
Grass tells me it cannot find the map. But I don't even know where exactly I
put the name of the file is it
map=$name_of_raster or map=name_of_raster.
Does someone have the answer?
Have you followed the example to its end, i.e. to the examples ?
Actually, what is says is that you have to create a text file containing the script:
#!/bin/sh
# Author: me, today; copyright: GPL >= 2
# Purpose: Script to set computational region to a raster map
# Usage: d.rast.region rastermap
g.region rast=$1
d.erase
d.rast $1
exit 0
Then you save this text file (for example using as filename d.rast.region) and call it with the shell interpreter sh and giving it the name of a raster map as input. You have to open a monitor (using the command d.mon) before calling the script for it to work:
d.mon x0
sh d.rast.region elev_state_500m
Here elev_state_500m is the name of a raster map (from the North Carolina Demo data you can find on the GRASS web site).
Moritz
Ok, thanks!
--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Basic-problem-with-defining-parameter-tp5166498p5167064.html
Sent from the Grass - Users mailing list archive at Nabble.com.