[GRASS-dev] About the "-g" switch of g.region

Hi dev-list!

Is there a reason why the output of "g.region -cg" (in decimal degrees) is
not the same as the output of "g.region -c" (in D:M:S)?

The -g switch is there to "print in shell script style". Does the
switch/description imply, necessarily, decimal degrees?

e.g.:

# grass70, same for grass643
g.region -c

north-south center: 40:20:04.5N
east-west center: 19:21:14.5E

# shell script style
g.region -cg

center_easting=19.354028
center_northing=40.334583

Thank you for your time,
Nikos

Nikos Alexandris wrote:

Is there a reason why the output of "g.region -cg" (in decimal degrees) is
not the same as the output of "g.region -c" (in D:M:S)?

The -g switch is there to "print in shell script style". Does the
switch/description imply, necessarily, decimal degrees?

I think it implies that the output is in a format amenable to use by
shell scripts.

DNS is primarily meant for humans; programs which aren't specifically
designed for geography or cartography won't understand DMS, so it will
have to be converted, and doing that in a shell script is messy (expr
and $((...)) only support integer arithmetic).

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

Nikos Alexandris wrote:

> Is there a reason why the output of "g.region -cg" (in decimal degrees)
> is not the same as the output of "g.region -c" (in D:M:S)?

> The -g switch is there to "print in shell script style". Does the
> switch/description imply, necessarily, decimal degrees?

Glynn Clements wrote:

I think it implies that the output is in a format amenable to use by
shell scripts.

DNS is primarily meant for humans; programs which aren't specifically
designed for geography or cartography won't understand DMS, so it will
have to be converted, and doing that in a shell script is messy (expr
and $((...)) only support integer arithmetic).

For the records, I require(d) a bunch of Landsat scene center coordinates.
Yes, in decimal degrees to feed the i.atcorr module. But, it took me a while,
to find it (-g). I was sure I have "grepped" decimal degrees from a grass-
module before -- couldn't recall, however, which one.

Personally a I would prefer a (slightly) different description for the switch,
or, at the very least, some additional note in the manual.

Thank you Glynn, Nikos