[GRASS-user] How to define the png image dimensions when using d.mon?

jean pierre huart jph at openjph.be
Tue Mar 8 07:28:35 PST 2016


Sorry I've forgotten to precise that I'm using Grass v7.0.3 on ubuntu 14.04.

On 08/03/16 16:15, jean pierre huart wrote:
> Hello,
>
> I've written a python script to generate an image combining a vector 
> map (myvector) and a raster (myraster) that has been generated using a 
> mask.
> It works great by default and creates an image with the default 
> dimensions 640x480 on a white background.
>
>         gscript.run_command('d.mon', overwrite=True, start='png', 
> output=filename)
>         gscript.run_command('d.rast', map='{0}@{1}'.format(myraster, 
> self.mapset))
>         gscript.run_command('d.vect', map='{0}@{1}'.format(myvector, 
> self.mapset), color='white', fill_color='none')
>         gscript.run_command('d.mon', stop="png")
>
> I would like to have a transparent background and to change the 
> dimensions of the image to 1280x960.
> Reading the documentation I had the impression that I just have to 
> modify some variables, but it does not work.
>
>         os.environ['GRASS_TRANSPARENT'] = 'TRUE'
>         os.environ['GRASS_WIDTH'] = str(1280)
>         os.environ['GRASS_HEIGHT'] = str(960)
>         gscript.run_command('d.mon', overwrite=True, start='png', 
> output=filename)
>         gscript.run_command('d.rast', map='{0}@{1}'.format(myraster, 
> self.mapset))
>         gscript.run_command('d.vect', map='{0}@{1}'.format(myvector, 
> self.mapset), color='white', fill_color='none')
>         gscript.run_command('d.mon', stop="png")
>
> Thanks in advance for any advice.
> Ciao
>

-- 
Jean Pierre Huart

OpenJph
19, rue de la fontaine
1340 Ottignies
web: www.openjph.be
email: jph at openjph.be
tel:   +32 487 95 77 75
skype: jeanpierre.huart



More information about the grass-user mailing list