[GRASS-user] check vector geometry

Glynn Clements glynn at gclements.plus.com
Mon Sep 25 13:35:46 EDT 2006


Maciej Sieczka wrote:

> >> The region extent is printed, like if -e alone was used, but instead of
> >> "region north-south extent" we get "ns_extent". Same thing, but
> >> different wording.
> 
> > That makes sense. The -e flag displays the extents, while -g selects a
> > machine-readable format. Using both should display the extents in a
> > machine-readable format.
> 
> Indeed it makes much sense, I get it. Hmm, but then -gc, -gl should
> also output in a machine-readable format - but they don't, they still
> print like if -c, -l was used alone.
> 
> Moreover, g.region description says: "-g Print the current region
> (shell script style)". It doesn't mention the fact it can be combined
> with other flags to make them print in shell script style - it only
> mentions the region.
> 
> Given these, how should g.region be fixed then?

I suggest:

1. Make -g, -l and -m orthogonal to other options, i.e. any option
which displays some information should take account of these options.

2. Make -p, -e and -c orthogonal rather than mutually exclusive, i.e. 
any combination of those three flags should be allowed, with multiple
flags resulting in multiple pieces of information being displayed.

3. If either -g or -l (or both) are given, and none of -p, -e or -c
are given, assume -p.

> I suppose that -g alone should not work at all. Only when combined with
> -p,-e,-c,-l it should print their machine-readable version. That would
> make things clear and consistent. Of course not a plan for Grass 6.
> Grass 7?

See #3 above. This can be implemented now, as all of the "intended"
combinations of flags will still produce the same output. Only the
behaviour for unintended combinations will change.

> > Note that -g is essentially shorthand for -pg; any option which
> > selects an output format implies -p unless some other option is given.
> 
> That's good to know, but it is not the way it is explained in Description.

I suspect that the behaviour is accidental rather than by design. -g
chooses a specific mode, but the code which handles -e also checks the
state of -g. IOW, it's both a mode and a modifier.

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




More information about the grass-user mailing list