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

Glynn Clements glynn.clements at virgin.net
Sun Nov 10 05:03:59 EST 2002

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.]

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

Note that the following will work:

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

Glynn Clements <glynn.clements at virgin.net>

More information about the grass-dev mailing list