Hi jean pierre huart,
I have exported png image using module “d.out.file”,(I have pasted a part of the script below which I have used. I hope this will help you…
…
import grass.script as g
import os
import shutil
import time
g.run_command(‘r.colors’,map=str(i),rules=‘color_table.txt’)
g.start_command(‘d.mon’, start=‘wx1’)
time.sleep(10)
g.run_command(‘d.rast’, map=str(i))
time.sleep(10)
g.run_command(‘d.vect’, map=str(i))
time.sleep(40)
g.run_command(‘d.out.file’,output=str(i),format=‘png’,size=(2403,2403))
time.sleep(10)
g.run_command(‘d.mon’, stop=‘wx1’)
time.sleep(10)
…
Regards,
Vinay
···
- How to define the png image dimensions when using d.mon?
(jean pierre huart)- Re: How to define the png image dimensions when using d.mon?
(jean pierre huart)
Message: 1
Date: Tue, 8 Mar 2016 16:15:01 +0100
From: jean pierre huart <jph@openjph.be>
To: grass-user@lists.osgeo.org
Subject: [GRASS-user] How to define the png image dimensions when
using d.mon?
Message-ID: <56DEEC75.5030709@openjph.be>
Content-Type: text/plain; charset=iso-8859-15; format=flowedHello,
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
Message: 2
Date: Tue, 8 Mar 2016 16:28:35 +0100
From: jean pierre huart <jph@openjph.be>
To: grass-user@lists.osgeo.org
Subject: Re: [GRASS-user] How to define the png image dimensions when
using d.mon?
Message-ID: <56DEEFA3.2050007@openjph.be>
Content-Type: text/plain; charset=utf-8; format=flowedSorry 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 HuartOpenJph
19, rue de la fontaine
1340 Ottignies
web: www.openjph.be
email: jph@openjph.be
tel: +32 487 95 77 75
skype: jeanpierre.huart
Subject: Digest Footer
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user
End of grass-user Digest, Vol 119, Issue 12