[GRASS-dev] r.distance: 'maps=map1,map2' vs 'maps=map1 maps=map2'

Hi,

I have discovered an undocumented feature (?) in r.distance.

The manual reads:

r.distance maps=map1,map2

When I specify it as:

r.distance maps=map1 maps=map2

it works as well.

The order can also be controlled this way. I.e.:

r.distance maps=map1,map2 is equivalent to r.distance maps=map1 maps=map2

and:

r.distance maps=map2,map1 is equivalent to r.distance maps=map2 maps=map1

Can I rely on this behavior or may it change in future? Currently it works for 6.4 svn and 7 svn.

Maciek

--
Maciej Sieczka
http://www.sieczka.org

W dniu 11.11.2010 18:22, Maciej Sieczka pisze:

Hi,

I have discovered an undocumented feature (?) in r.distance.

The manual reads:

r.distance maps=map1,map2

When I specify it as:

r.distance maps=map1 maps=map2

it works as well.

The order can also be controlled this way. I.e.:

r.distance maps=map1,map2 is equivalent to r.distance maps=map1 maps=map2

and:

r.distance maps=map2,map1 is equivalent to r.distance maps=map2 maps=map1

Can I rely on this behavior or may it change in future? Currently it
works for 6.4 svn and 7 svn.

I'm asking this because the 'maps=map1 maps=map2' syntax would let me add the command to QGIS GRASS toolbox - now. Otherwise, it would require adding support for 'maps=map1,map2' syntax - unknown if/when would be implemented.

Maciek

--
Maciej Sieczka
http://www.sieczka.org

Maciej Sieczka wrote:

I have discovered an undocumented feature (?) in r.distance.

The manual reads:

r.distance maps=map1,map2

When I specify it as:

r.distance maps=map1 maps=map2

it works as well.

This is a feature of the parser, and works for all modules.

The order can also be controlled this way. I.e.:

r.distance maps=map1,map2 is equivalent to r.distance maps=map1 maps=map2

and:

r.distance maps=map2,map1 is equivalent to r.distance maps=map2 maps=map1

Can I rely on this behavior or may it change in future? Currently it
works for 6.4 svn and 7 svn.

It isn't expected to change. It's useful for constructing argument
lists using xargs, e.g.:

  ... | sed 's/^/map=/' | xargs g.something ...

This is much harder to achieve using the opt=val,val,val,... syntax.

--
Glynn Clements <glynn@gclements.plus.com>