[GRASS-user] syntax for setting GRASS_PNGFILE from Python script

Damian M maddalena at nc.rr.com
Tue Aug 31 16:38:13 EDT 2010


I am new to scripting GRASS with Python.  I am having trouble with the proper
syntax for setting the value of GRASS_PNGFILE within Python for the purposes
of automated map creation using the PNG driver.  I can do this in the BASH
shell as: 

GRASS_PNGFILE=mywaycoolmap.png
export GRASS_PNGFILE

What is the proper syntax for setting this in Python?

I have tried something like:

def jpgMap():
    #SET PNG OUTPUT FILE NAME
    grass.run_command("g.gisenv", set="GRASS_PNGFILE=testName.png")
    #BUILD MAP
    grass.run_command("d.mon", start="PNG")
    grass.run_command("d.vect", map="parcelBoundaries", col="black",
fcolor="none", width="2")
    grass.run_command("d.barscale", bcolor="white", tcolor="black",
at="0,95")
    grass.run_command("d.text", text='Test Python Map', at="29,95",
color="black")
    #CLOSE PNG FILE
    grass.run_command("d.mon", stop="PNG")
jpgMap()

This does not work.  I still get map.png.  

I am using 6.4svn complied from source on Ubuntu 9.10.

Thank you.
-- 
View this message in context: http://osgeo-org.1803224.n2.nabble.com/syntax-for-setting-GRASS-PNGFILE-from-Python-script-tp5484418p5484418.html
Sent from the Grass - Users mailing list archive at Nabble.com.


More information about the grass-user mailing list