[GRASS5] Re: r.mapcalc x() with no layer in expression

Dan Jacobson jidanni at dman.ddts.net
Mon Nov 11 03:33:16 EST 2002


>>>>> "G" == Glynn Clements <glynn.clements at virgin.net> writes:

G> Dan Jacobson wrote:

>> Does the r.mapcalc man page and tutorial assume that one has the name
>> of an input map layer in some other part of the equation and thus
>> never mentions what happens if you don't, but still want to use x(),
>> y()?
>> 
>> Is this what one would be forced to do in that case?
>> (e.g. when making a layer with values being the distance from home:)
>> out=nantou.dist xc=235577 yc=2675353 ;\
>> r.mapcalc "${out?} = nantou - nantou + sqrt((x() - ${xc?})^2 + (y() - ${yc?})^2)"
>> [nantou - nantou: a noop just to get the layer nantou involved in the
>> expression.]

G> Why would you want to involve a map which wasn't actually used?

G> Note that the following will work:

G> 	r.mapcalc "${out?} = sqrt((x() - ${xc?})^2 + (y() - ${yc?})^2)"

OK, and indeed it does.
Well, it's not my fault that I didn't know that: the r.mapcalc man
page goes on and on about "raster map layers", never hinting that what
it really does is just march thru each cell[?] in the current region,
independently of any raster map, making calculations at each cell...
Maybe the man page should mention something like this near the top. 

BTW: I see an "&amp;"'s there instead of & , e.g.:
       Some characters have special meaning to the
       UNIX shell.  These include, among others:

       * ( ) > &amp; |

Also:
   BUGS
       Continuation  lines  must end with a  and have NO trailing

End with a what?  Can't tell from the manpage [5.0pre1].
-- 
http://jidanni.org/ Taiwan(04)25854780





More information about the grass-dev mailing list