Skip to content
Permalink
Browse files
updates for GRASS GIS 7 support; file date updated in comment
  • Loading branch information
Markus Neteler committed Feb 7, 2015
1 parent c67e31d commit 0a1382a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 16 deletions.
@@ -4,8 +4,8 @@
***************************************************************************
Grass7Algorithm.py
---------------------
Date : April 2014
Copyright : (C) 2014 by Victor Olaya
Date : February 2015
Copyright : (C) 2014-2015 by Victor Olaya
Email : volayaf at gmail dot com
***************************************************************************
* *
@@ -18,8 +18,8 @@
"""

__author__ = 'Victor Olaya'
__date__ = 'April 2014'
__copyright__ = '(C) 2014, Victor Olaya'
__date__ = 'February 2015'
__copyright__ = '(C) 2012-2015, Victor Olaya'

# This will get replaced with a git SHA1 when you do a git archive

@@ -270,6 +270,7 @@ def processAlgorithm(self, progress):
region = str(self.getParameterValue(self.GRASS_REGION_EXTENT_PARAMETER))
regionCoords = region.split(',')
command = 'g.region'
command += ' -a'
command += ' n=' + str(regionCoords[3])
command += ' s=' + str(regionCoords[2])
command += ' e=' + str(regionCoords[1])
@@ -354,11 +355,11 @@ def processAlgorithm(self, progress):

# Raster layer output: adjust region to layer before
# exporting
commands.append('g.region rast=' + out.name + uniqueSufix)
outputCommands.append('g.region rast=' + out.name
commands.append('g.region raster=' + out.name + uniqueSufix)
outputCommands.append('g.region raster=' + out.name
+ uniqueSufix)
if self.grassName == 'r.composite':
command = 'r.out.tiff -t --verbose'
command = 'r.out.tiff -t --verbose' # FIXME r.out.tiff deprecated, use r.out.gdal
command += ' input='
command += out.name + uniqueSufix
command += ' output="' + filename + '"'
@@ -4,8 +4,8 @@
***************************************************************************
GrassUtils.py
---------------------
Date : April 2014
Copyright : (C) 2014 by Victor Olaya
Date : February 2015
Copyright : (C) 2014-2015 by Victor Olaya
Email : volayaf at gmail dot com
***************************************************************************
* *
@@ -18,8 +18,8 @@
"""

__author__ = 'Victor Olaya'
__date__ = 'April 2014'
__copyright__ = '(C) 2014, Victor Olaya'
__date__ = 'February 2015'
__copyright__ = '(C) 2014-2015, Victor Olaya'

# This will get replaced with a git SHA1 when you do a git archive

@@ -207,12 +207,10 @@ def createTempMapset():
'QGIS GRASS GIS 7 interface: temporary data processing location.\n')
outfile.close()

# FIXME: in GRASS 7 the SQLite driver is default (and more powerful)
Grass7Utils.writeGrass7Window(os.path.join(folder, 'PERMANENT', 'WIND'))
mkdir(os.path.join(folder, 'PERMANENT', 'dbf'))
outfile = open(os.path.join(folder, 'PERMANENT', 'VAR'), 'w')
outfile.write('DB_DRIVER: dbf\n')
outfile.write('DB_DATABASE: $GISDBASE/$LOCATION_NAME/$MAPSET/dbf/\n')
outfile.write('DB_DRIVER: sqlite\n')
outfile.write('DB_DATABASE: $GISDBASE/$LOCATION_NAME/$MAPSET/sqlite/sqlite.db\n')
outfile.close()

@staticmethod
@@ -133,7 +133,7 @@ def exportVectorLayer(self, layer):
destFilename = self.getTempFilename()
command = 'v.in.ogr'
command += ' min_area=-1'
command += ' dsn="' + os.path.dirname(layer) + '"'
command += ' input="' + os.path.dirname(layer) + '"'
command += ' layer=' + os.path.basename(layer)[:-4]
command += ' output=' + destFilename
command += ' --overwrite -o'

0 comments on commit 0a1382a

Please sign in to comment.