[GRASS5] d.info: flag added for approximate screen scale

Glynn Clements glynn at gclements.plus.com
Thu Jan 5 10:19:55 EST 2006

Markus Neteler wrote:

> I have added a new flag to d.info to print the
> approximate map scale in GRASS monitor. I know that
> it's not very precise, but an approximate figure
> is better than nothing:
> Example:
>  d.info -s
>  Approximate map scale in GRASS monitor <x0> 1:11000
> I remember that this was removed in GRASS 5 (not by me)

It was removed for a reason, namely that it relied upon a whole bunch
of assumptions (e.g. you have X libraries installed, you are using X,
the monitor being queried is XDRIVER, you know which X display the
monitor is using, etc) which aren't guaranteed to be true.

> but IMHO a GIS should be able to give such information.

The driver protocol doesn't include the necessary support.

The feature relied upon assuming that you can find X display, querying
the resolution of that display, and assuming that display is the one
which the monitor is using.

> The algorithm takes the monitor size, the map size within
> the monitor and the screen resolution (x DPI and y DPI)
> into account. The latter may not be precise, depending on
> the X server software, video card or monitor. The 
> figure is therefore given rounded.
> It still needs to be make optional in the Makefile
> in case of X absences. Hints for a test are welcome.

The configure script only determines which libraries are available. It
cannot determine whether or not you want to use them. In the case of
the d.info hack, it's entirely possible that you won't want it even if
the X libraries are available on the build system (e.g. because you
want to build a package for distribution, and don't want to include a
version of d.info which simply won't run on systems without Xlib).

> I hope the flag survives this time :-)

Not if I have anything to do with it.

The reasons for its removal remain valid. Primarily, the fact that it
caused the d.info executable to have an Xlib dependency. The other
problems don't matter so long as you don't use the -s switch.

Glynn Clements <glynn at gclements.plus.com>

More information about the grass-dev mailing list