[GRASS-windows] grass_width, grass_heigt and grass_pngfile
Glynn Clements
glynn at gclements.plus.com
Sat Mar 3 11:15:08 EST 2012
Liu, Huili wrote:
> I am trying to create a python script to get an image file as below:
>
> #get_img.py
> import os.path
> import sys # the sys module [2]
> from grass.script import core as grass # the core module [3]
> def main():
> grass.run_command('d.his i=elevation_shade h=elevation')
This is wrong; it should be:
grass.run_command('d.his', i='elevation_shade', h='elevation')
> if __name__ == "__main__": # this allows the script to be used as a module in other scripts or as a standalone script
> #options, flags = grass.parser() #
> sys.exit(main())
>
> But I got the default image file name, map.png with GRASS_WIDTH=640 and GRASS_HEIGHT=480.
> Is there any way for me to setup width and height and my image file name in grass.run_command?
> I searched the doc for a while but I still can not get a correct syntax.
import os
os.environ['GRASS_PNGFILE'] = filename
os.environ['GRASS_WIDTH'] = str(width)
os.environ['GRASS_HEIGHT'] = str(height)
--
Glynn Clements <glynn at gclements.plus.com>
More information about the grass-windows
mailing list