Skip to content

Commit

Permalink
wxGUI Raster Digitizer: fix use input raster map layer region (#470)
Browse files Browse the repository at this point in the history
  • Loading branch information
tmszi committed Apr 7, 2020
1 parent a89c8e5 commit d48aa48
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions gui/wxpython/rdigit/controller.py
Expand Up @@ -81,6 +81,8 @@ def __init__(self, giface, mapWindow):
self._currentCellValue = None
# last edited buffer value
self._currentWidthValue = None
# digit env
self._env = os.environ.copy()

self._oldMouseUse = None
self._oldCursor = None
Expand Down Expand Up @@ -469,6 +471,8 @@ def _exportRaster(self):
keep the order of editing. These rasters are then patched together.
Sets default color table for the newly digitized raster.
"""
self._setRegion()

if not self._editedRaster or self._running:
return
self._running = True
Expand Down Expand Up @@ -525,7 +529,8 @@ def _exportRaster(self):
gcore.run_command(
'r.patch', input=rastersToPatch[:: -1] +
[self._backupRasterName],
output=self._editedRaster, overwrite=True, quiet=True)
output=self._editedRaster, overwrite=True, quiet=True,
env=self._env)
gcore.run_command(
'g.remove',
type='raster',
Expand Down Expand Up @@ -605,9 +610,15 @@ def _rasterize(self, text, bufferDist, mapType, tempRaster):
overwrite=True,
quiet=True)
gcore.run_command('r.grow', input=tempRaster, output=output,
flags='m', radius=bufferDist, quiet=True)
flags='m', radius=bufferDist, quiet=True,
env=self._env)
else:
gcore.run_command('r.in.poly', input=asciiFile.name, output=output,
type_=mapType, quiet=True)
type_=mapType, quiet=True, env=self._env)
os.unlink(asciiFile.name)
return output

def _setRegion(self):
"""Set region according input raster map"""
self._env['GRASS_REGION'] = gcore.region_env(
raster=self._backupRasterName)

0 comments on commit d48aa48

Please sign in to comment.