[GRASS-dev] pygrass: Region.set_current() doesn't work

Martin Zbinden martin.zbinden at gmail.com
Fri Jul 25 01:39:35 PDT 2014

I've  come across some trouble defining the computational region from pygrass:

If I understand correctly, Region.set_current() can be used
to effectively change the region currently used by GRASS. But changing
extent of Raster()-object and executing set_current() does not have
any effect.

Below is a minimal example.

Can somebody tell me if this is a bug or simply a misunderstanding from my site?
I am using GRASS GIS 7 (SVN rev 61281) on Linux Mint 17.

Thanks for any help.

minimal working example:
#!/usr/bin/env python
#-*- coding: utf-8 -*-
from grass.pygrass.gis.region import Region
from grass.pygrass.modules.shortcuts import raster as r, vector as v,
general as g, display as d

region = Region()
# here region information are still identical, Region() seems to be
initialized with current region

region.north += 100
region.east += 100
region.south -= 100
region.west -= 100
#  g.region(flags='p') still shows the old region settings, not the
enlarged region

r.mapcalc("test = 1")
# load in QGIS, is really size of old region

Martin Zbinden
Riedacker 523
3154 Rüschegg Heubach
+41 78 628 28 82

More information about the grass-dev mailing list