[GRASS-dev] display monitor (how to everlay 2 layers)

epi massimodisasha at gmail.com
Tue Mar 3 07:23:40 PST 2015


Hi,

i’m trying to generate a png from python using the the d.mon / d. last / d.vect commands

in the past (grass70) this code worked fine :


GRASS_TRANSPARENT=TRUE
GRASS_TRUECOLOR=TRUE
GRASS_PNG_COMPRESSION=9
GRASS_PNG_AUTO_WRITE=TRUE
export GRASS_TRANSPARENT GRASS_TRUECOLOR GRASS_PNG_COMPRESSION GRASS_PNG_AUTO_WRITE

d.mon start=cairo --q output={mapname}.png
g.region rast={mapname} n={n} s={s} w={w} e={e} -a --q
d.rast map={mapname} --q
d.vect map={mapname} color={vcolor} size={vsize} icon={icon} --q
d.mon stop=cairo --q


but now is not generating any png :( 

browsing the add ons i saw v.out.png is no more in trunk and i gave it a try :

###
import os
import sys
from grass.script import core as grass
from grass.script import gisenv
from grass.pygrass.modules.shortcuts import display as d
from grass.pygrass.modules.shortcuts import general as g

os.environ['GRASS_RENDER_IMMEDIATE'] = 'png'
os.environ['GRASS_RENDER_FILE'] = 'pfile3.png'
os.environ['GRASS_RENDER_FILE_COMPRESSION'] = '9'
os.environ['GRASS_RENDER_WIDTH'] = '640'
os.environ['GRASS_RENDER_HEIGHT'] = '480'
os.environ['GRASS_RENDER_TRANSPARENT']='TRUE'

monitor_old = None
genv = gisenv()
if 'MONITOR' in genv:
    monitor_old = genv['MONITOR']
    g.gisenv(unset='MONITOR')

d.vect(map='p')
d.rast(map='basemap')
###

this time the png is generated, but i’m no more able to overlay 2 different layers to compose my map …

Have you any thoughts on what’s wrong in those procedures ?

I tried on the osgeolive, the first approach works for grass70. 
building grass71 and try it again … no png is generated.


Thanks for any advice.

Massimo.



More information about the grass-dev mailing list