[GRASS-user] How to define the png image dimensions when using d.mon?
Vinay Elothunkal
vinay223333 at gmail.com
Tue Mar 8 20:10:28 PST 2016
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
>
> 1. How to define the png image dimensions when using d.mon?
> (jean pierre huart)
> 2. 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 at openjph.be>
> To: grass-user at lists.osgeo.org
> Subject: [GRASS-user] How to define the png image dimensions when
> using d.mon?
> Message-ID: <56DEEC75.5030709 at openjph.be>
> Content-Type: text/plain; charset=iso-8859-15; format=flowed
>
> 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
>
>
>
> ------------------------------
>
> Message: 2
> Date: Tue, 8 Mar 2016 16:28:35 +0100
> From: jean pierre huart <jph at openjph.be>
> To: grass-user at lists.osgeo.org
> Subject: Re: [GRASS-user] How to define the png image dimensions when
> using d.mon?
> Message-ID: <56DEEFA3.2050007 at openjph.be>
> Content-Type: text/plain; charset=utf-8; format=flowed
>
> 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
>
>
>
> ------------------------------
>
> Subject: Digest Footer
>
> _______________________________________________
> grass-user mailing list
> grass-user at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-user
>
> ------------------------------
>
> End of grass-user Digest, Vol 119, Issue 12
> *******************************************
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20160309/bc5eee2b/attachment.html>
More information about the grass-user
mailing list