<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-15">
</head>
<body text="#000000" bgcolor="#FFFFFF">
Dear Group,<br>
<br>
I ran into a problem and can´t find a soloution for myself.<br>
So if anybody has an idea or a hind it would help me a lot!!<br>
<br>
So her now the description of my problem:<br>
<br>
My task is to write a python script to run GRASS commands from the
outside (without starting GRASS explicit).<br>
I work with GRASS 6.4.3 and Ubuntu 12.4 (OSGEO Live 7.0).<br>
At first I wrote a script using r.los and everything work fine, than
I changed to the r.viewshed command (I have to !)<br>
and it didn´t worked any more.<br>
So, as You can see here in the script, the parameters are the same
but when I use r.viewshed instead of r.los I´am in trouble!<br>
<br>
Python script (also attached):<br>
<br>
#!/usr/bin/python<br>
<br>
<br>
import os<br>
import sys<br>
import csv<br>
<br>
gisbase = os.environ['GISBASE'] = "/usr/lib/grass64"<br>
<br>
sys.path.append(os.path.join(os.environ['GISBASE'], "etc",
"python"))<br>
import grass.script as grass<br>
import grass.script.setup as gsetup<br>
<br>
<br>
<br>
gisdbase = os.path.join(os.environ['HOME'], "GRASSDATA")<br>
location = "Goelenkamp"<br>
mapset = "PERMANENT"<br>
<br>
gsetup.init(gisbase, gisdbase, location, mapset)<br>
<br>
print grass.gisenv()<br>
<br>
<br>
input_map = 'DHM'<br>
<br>
StandorteWEA = csv.DictReader(open("StandorteWEA.csv", "rb"),
delimiter=",")<br>
for row in StandorteWEA:<br>
WEA = row["WEA"]<br>
Windpark = row["Windpark"]<br>
output_map = 'tmp_' + WEA<br>
# HERE is the Problem:<br>
# the next line works only when the script es started from
within the terminal window from the started GRASS session<br>
#grass.run_command('r.viewshed', input = input_map, output =
output_map, coordinate=[2560807,5823616], obs_elev=100,
max_dist=3000, overwrite=True)<br>
<br>
# the next line works fine from "within" and from "without" <br>
grass.run_command('r.los', input = input_map, output =
output_map, coordinate = '2560807,5823616', obs_elev = '100',
max_dist = '300', overwrite=True)<br>
<br>
grass.run_command('r.null', map = ('tmp_' + WEA))<br>
<br>
<br>
<br>
And here is the error message:<br>
<br>
<img alt="Screenshot Error Message"
src="cid:part1.07060605.07070301@t-online.de" width="962"
height="435"><br>
<br>
<br>
Thanks in advance!<br>
<br>
Stefan<br>
<br>
<br>
</body>
</html>