本文整理汇总了Python中GrassUtils.GrassUtils.createTempMapset方法的典型用法代码示例。如果您正苦于以下问题:Python GrassUtils.createTempMapset方法的具体用法?Python GrassUtils.createTempMapset怎么用?Python GrassUtils.createTempMapset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GrassUtils.GrassUtils
的用法示例。
在下文中一共展示了GrassUtils.createTempMapset方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: processAlgorithm
# 需要导入模块: from GrassUtils import GrassUtils [as 别名]
# 或者: from GrassUtils.GrassUtils import createTempMapset [as 别名]
def processAlgorithm(self, progress):
commands = []
vector = self.getParameterValue(self.VECTOR)
elevation = self.getParameterValue(self.ELEVATION)
color = self.getParameterValue(self.COLOR)
region = \
unicode(self.getParameterValue(self.GRASS_REGION_EXTENT_PARAMETER))
regionCoords = region.split(',')
command = 'g.region '
command += 'n=' + unicode(regionCoords[3])
command += ' s=' + unicode(regionCoords[2])
command += ' e=' + unicode(regionCoords[1])
command += ' w=' + unicode(regionCoords[0])
cellsize = self.getParameterValue(self.GRASS_REGION_CELLSIZE_PARAMETER)
if cellsize:
command += ' res=' + unicode(cellsize)
else:
command += ' res=' + unicode(self.getDefaultCellsize())
commands.append(command)
command = 'nviz'
if vector:
layers = vector.split(';')
for layer in layers:
(cmd, newfilename) = self.exportVectorLayer(layer)
commands.append(cmd)
vector = vector.replace(layer, newfilename)
command += ' vector=' + vector.replace(';', ',')
if color:
layers = color.split(';')
for layer in layers:
(cmd, newfilename) = self.exportRasterLayer(layer)
commands.append(cmd)
color = color.replace(layer, newfilename)
command += ' color=' + color.replace(';', ',')
if elevation:
layers = elevation.split(';')
for layer in layers:
(cmd, newfilename) = self.exportRasterLayer(layer)
commands.append(cmd)
elevation = elevation.replace(layer, newfilename)
command += ' elevation=' + elevation.replace(';', ',')
if elevation is None and vector is None:
command += ' -q'
commands.append(command)
GrassUtils.createTempMapset()
GrassUtils.executeGrass(commands, progress)