GRASS logo

Display drivers

Table of contents

The current command line rendering mechanism is direct rendering into a file. The driver is selected by setting the GRASS_RENDER_IMMEDIATE variable or by running d.mon module.

List of available display drivers:



If environmental variable GRASS_RENDER_COMMAND is defined, rendering is redirected by display library to the given external command defined by this variable. Currently only Python scrips are supported.

Lets start with simple example of Python script called

#!/usr/bin/env python3

import os
import sys

import grass.script as grass
from grass.script import task as gtask

os.environ['GRASS_RENDER_IMMEDIATE'] = 'default'
os.environ['GRASS_RENDER_FILE'] = 'output.png'

cmd, dcmd = gtask.cmdstring_to_tuple(sys.argv[1])

grass.run_command('d.text', text="Test of GRASS_RENDER_COMMAND redirection")

grass.run_command(cmd, **dcmd)
After defining GRASS_RENDER_COMMAND variable (example for Bash):
Display GRASS modules like d.rast or d.vect will be executed by program. For example the command
d.vect roadsmajor
produces output PNG file output.png which will contain rendered features from vector map roadsmajor and sample text "Test of GRASS_RENDER_COMMAND redirection".


d.mon, variables


Available at: Display drivers source code (history)

Latest change: Thu Jan 20 05:08:28 2022 in commit: 433bfe70a10bb18dcc70df687d3ee0a020f640e6

Main index | Display index | Topics index | Keywords index | Graphical index | Full index

© 2003-2022 GRASS Development Team, GRASS GIS 7.8.7dev Reference Manual