Skip to content

d.mon

Controls graphics display monitors from the command line.

d.mon [-lpcgsrtux] [start=string] [stop=string] [select=string] [width=value] [height=value] [resolution=value] [bgcolor=name] [output=name] [--overwrite] [--verbose] [--quiet] [--qq] [--ui]

Example:

d.mon

grass.script.run_command("d.mon", start=None, stop=None, select=None, width=None, height=None, resolution=None, bgcolor="white", output=None, flags=None, overwrite=False, verbose=False, quiet=False, superquiet=False)

Example:

gs.run_command("d.mon")

Parameters

start=string
    Name of monitor to start
    Allowed values: wx0, wx1, wx2, wx3, wx4, wx5, wx6, wx7, png, ps, html, cairo
stop=string
    Name of monitor to stop
    Allowed values: wx0, wx1, wx2, wx3, wx4, wx5, wx6, wx7, png, ps, html, cairo
select=string
    Name of monitor to select
    Allowed values: wx0, wx1, wx2, wx3, wx4, wx5, wx6, wx7, png, ps, html, cairo
width=value
    Width for display monitor if not set by GRASS_RENDER_WIDTH
    Default value: 720
height=value
    Height for display monitor if not set by GRASS_RENDER_HEIGHT
    Default value: 480
resolution=value
    Dimensions of display monitor versus current size
    Example: resolution=2 enlarge display monitor twice to 1280x960
bgcolor=name
    Background color
    Either a standard color name, R:G:B triplet, or "none"
    Default: white
output=name
    Name for output file (when starting new monitor)
    Ignored for 'wx' monitors
-l
    List running monitors and exit
-p
    Print name of currently selected monitor and exit
-c
    Print commands for currently selected monitor and exit
-g
    Print path to support files of currently selected monitor and exit
-s
    Do not automatically select when starting
-r
    Release and stop currently selected monitor and exit
-t
    Disable true colors
-u
    Open output file in update mode
    Requires --overwrite flag
-x
    Launch light-weight wx monitor without toolbars and statusbar
    Requires 'start=wx0-7'
--overwrite
    Allow output files to overwrite existing files
--help
    Print usage summary
--verbose
    Verbose module output
--quiet
    Quiet module output
--qq
    Very quiet module output
--ui
    Force launching GUI dialog

start : str, optional
    Name of monitor to start
    Allowed values: wx0, wx1, wx2, wx3, wx4, wx5, wx6, wx7, png, ps, html, cairo
stop : str, optional
    Name of monitor to stop
    Allowed values: wx0, wx1, wx2, wx3, wx4, wx5, wx6, wx7, png, ps, html, cairo
select : str, optional
    Name of monitor to select
    Allowed values: wx0, wx1, wx2, wx3, wx4, wx5, wx6, wx7, png, ps, html, cairo
width : int, optional
    Width for display monitor if not set by GRASS_RENDER_WIDTH
    Default value: 720
    Used as: value
height : int, optional
    Height for display monitor if not set by GRASS_RENDER_HEIGHT
    Default value: 480
    Used as: value
resolution : int, optional
    Dimensions of display monitor versus current size
    Example: resolution=2 enlarge display monitor twice to 1280x960
    Used as: value
bgcolor : str, optional
    Background color
    Either a standard color name, R:G:B triplet, or "none"
    Used as: input, color, name
    Default: white
output : str, optional
    Name for output file (when starting new monitor)
    Ignored for 'wx' monitors
    Used as: output, file, name
flags : str, optional
    Allowed values: l, p, c, g, s, r, t, u, x
    l
        List running monitors and exit
    p
        Print name of currently selected monitor and exit
    c
        Print commands for currently selected monitor and exit
    g
        Print path to support files of currently selected monitor and exit
    s
        Do not automatically select when starting
    r
        Release and stop currently selected monitor and exit
    t
        Disable true colors
    u
        Open output file in update mode
        Requires --overwrite flag
    x
        Launch light-weight wx monitor without toolbars and statusbar
        Requires 'start=wx0-7'
overwrite: bool, optional
    Allow output files to overwrite existing files
    Default: False
verbose: bool, optional
    Verbose module output
    Default: False
quiet: bool, optional
    Quiet module output
    Default: False
superquiet: bool, optional
    Very quiet module output
    Default: False

DESCRIPTION

d.mon allows the user to start, select, list, release, and stop available graphics monitors.

Starting a monitor

In order to display on-screen GRASS graphics, the user must start and select a graphics monitor. By default, the start command actually runs two commands, to both start and select whatever monitor is named by the user. The user can get a list of running monitors by setting the -l flag on the command line. Note that some monitor drivers use environment variables or the specific driver documentation.

When a monitor is started, it is therefore also (automatically) selected for output, unless the -s flag is set by the user; the user can also explicitly select a monitor that has been started.

The desired monitor should be started once and need not be restarted unless it is stopped for some reason. A monitor may continue to run for any length of time, even when no GRASS session is being run.

Listing currently running monitors

A graphics monitor has two different types of status: monitor program not running, and monitor running. A monitor that has been started and/or selected will be listed as running; a monitor that has been stopped (or not started) will be listed as not running. The -l flag will list all currently running monitors.

Selecting a monitor

When the user starts a monitor, it is also (automatically) selected for graphics output unless the user sets the -s flag. In order to use (direct graphics output to) a monitor, the user must select that monitor for use, either by simply starting the monitor without the -s flag or by explicitly selecting the monitor for output. Only running monitors can be selected for graphics output.

The user can run multiple graphics monitors by simply starting each of the graphics monitors the user wishes to direct output to.

Releasing (unselecting) a monitor

Currently selected a monitor can be released by -r flag.

NOTES

d.mon is designed for interactive use. If non-interactive use is needed (e.g., in a script) set GRASS_RENDER_IMMEDIATE=png (or =cairo) and use the related environment variables to control output size etc.

EXAMPLES

wx0 monitor

To start the interactive wxGUI map display, run

d.mon start=wx0

Blank wx0 display
Figure: The initialization of display monitor wx0

All subsequently displayed data will be rendered on monitor wx0.

g.region raster=elevation -p
d.rast map=elevation

Display wx0 with raster map
Figure: The display wx0 showing an elevation raster map

CAIRO file renderer monitor

A CAIRO monitor can be started (and selected) by

d.mon start=cairo output=out.pdf

From this moment on all displayed data will be rendered into file output.pdf.

List running monitors

To list the currently running monitors, use

d.mon -l

List of running monitors:
wx0
cairo

Show currently selected monitor

To identify the currently selected monitor, use

d.mon -p

cairo

Switching between monitors

To switch back to interactive display mode, here to an earlier started and still running wxGUI monitor, use

d.mon select=wx0

Stopping a monitor

To close the wxGUI monitor, run

d.mon stop=wx0

SEE ALSO

d.erase, d.redraw, d.rast, d.vect, d.frame

See also list of variables for rendering, display drivers

AUTHOR

Martin Landa, OSGeoREL, Czech Technical University in Prague, Czech Republic

SOURCE CODE

Available at: d.mon source code (history)
Latest change: Saturday Feb 15 00:20:39 2025 in commit ea58114