[GRASSLIST:4935] Re: 100KM raduis viewshed

Glynn Clements glynn.clements at virgin.net
Mon Nov 11 15:02:02 EST 2002


Dan Jacobson wrote:

> G> Alternatively, you could compute the heading relative to the centre
> G> of the map (or any other point) using the (undocumented)
> G> two-argument form of r.mapcalc's atan() function, e.g.
> 
> G> 	r.mapcalc "eval(heading = atan(x() - $xc, y() - $yc), ...
> 
> G> Note: the argument order is the reverse of ANSI C's atan2() function.
> 
> $ xc=235577 yc=2675353 ;\
> r.mapcalc "eval(heading = atan(x() - $xc, y() - $yc), \
> nantou.triang = heading>140 && heading<170)"
> you have confused me

Sorry, it should have been:

	r.mapcalc "$out = eval(heading = atan(x() - $xc, y() - $yc), ...

Paul's suggestion should work.

The input to r.mapcalc has to be of the form "name = expression", or a
sequence of such e.g. "name1 = expression1 ; name2 = expression2".

Assignments at the top level are treated differently to assignments
within an expression. An assignment at the top level creates a new
map, while assignments within an expression don't.

-- 
Glynn Clements <glynn.clements at virgin.net>




More information about the grass-user mailing list