[GRASS-dev] how to do g.region n=n+(defined by user input option) in a python script?

Martin Landa landa.martin at gmail.com
Thu May 8 04:59:12 PDT 2014


Hi,

2014-05-08 13:39 GMT+02:00 Helmut Kudrnovsky <hellik at web.de>:
> hi,
>
> I'm trying to understand how to use g.region n=n+x s=s-x e=e+x w=w-x in a
> python script, where x is a user option.
>
> some code snippets:
>
> #%option
> #% key: region_extension
> #% type: double
> #% key_desc: float
> #% description: region extension
> #% required : no
> #% answer: 5000
> #%end

this would be useful option for g.region (already thinking about
that), unfortunately this modules has so much flags and options...

> [...]
>
>     regext = options['region_extension']
>
> [...]
>
>     grass.run_command('g.region', n = n+regext,
>                                      s = s-regext,
>                                      e = e+regext,
>                                      w = w-regext)

n = 'n+%f' % regext

Martin


More information about the grass-dev mailing list