本文整理汇总了Python中processing.gdal.GdalUtils.GdalUtils.runGdal方法的典型用法代码示例。如果您正苦于以下问题:Python GdalUtils.runGdal方法的具体用法?Python GdalUtils.runGdal怎么用?Python GdalUtils.runGdal使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类processing.gdal.GdalUtils.GdalUtils
的用法示例。
在下文中一共展示了GdalUtils.runGdal方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: processAlgorithm
# 需要导入模块: from processing.gdal.GdalUtils import GdalUtils [as 别名]
# 或者: from processing.gdal.GdalUtils.GdalUtils import runGdal [as 别名]
def processAlgorithm(self, progress):
out = self.getOutputValue(self.OUTPUT)
mask = self.getParameterValue(self.MASK)
noData = str(self.getParameterValue(self.NO_DATA))
addAlphaBand = self.getParameterValue(self.ALPHA_BAND)
extra = str(self.getParameterValue(self.EXTRA))
arguments = []
arguments.append("-q")
arguments.append("-of")
arguments.append(GdalUtils.getFormatShortNameFromFilename(out))
arguments.append("-dstnodata")
arguments.append(noData)
arguments.append("-cutline")
arguments.append(mask)
arguments.append("-crop_to_cutline")
if addAlphaBand:
arguments.append("-dstalpha")
if len(extra) > 0:
arguments.append(extra)
arguments.append(self.getParameterValue(self.INPUT))
arguments.append(out)
GdalUtils.runGdal(["gdalwarp", GdalUtils.escapeAndJoin(arguments)], progress)
示例2: processAlgorithm
# 需要导入模块: from processing.gdal.GdalUtils import GdalUtils [as 别名]
# 或者: from processing.gdal.GdalUtils.GdalUtils import runGdal [as 别名]
def processAlgorithm(self, progress):
output = self.getOutputValue(self.OUTPUT)
arguments = []
arguments.append('-st')
arguments.append(str(self.getParameterValue(self.THRESHOLD)))
arguments.append('-' +
self.PIXEL_CONNECTIONS[self.getParameterValue(
self.CONNECTIONS)])
arguments.append('-of')
arguments.append(GdalUtils.getFormatShortNameFromFilename(output))
arguments.append(self.getParameterValue(self.INPUT))
arguments.append(output)
commands = []
if isWindows():
commands = ['cmd.exe', '/C ', 'gdal_sieve.bat',
GdalUtils.escapeAndJoin(arguments)]
else:
commands = ['gdal_sieve.py', GdalUtils.escapeAndJoin(arguments)]
GdalUtils.runGdal(commands, progress)
示例3: processAlgorithm
# 需要导入模块: from processing.gdal.GdalUtils import GdalUtils [as 别名]
# 或者: from processing.gdal.GdalUtils.GdalUtils import runGdal [as 别名]
def processAlgorithm(self, progress):
arguments = []
arguments.append('-a')
arguments.append(str(self.getParameterValue(self.FIELD)))
dimType = self.getParameterValue(self.DIMENSIONS)
if dimType == 0:
# size in pixels
arguments.append('-ts')
else:
# resolution in map units per pixel
arguments.append('-tr')
arguments.append(str(self.getParameterValue(self.WIDTH)))
arguments.append(str(self.getParameterValue(self.HEIGHT)))
arguments.append('-l')
arguments.append(
os.path.basename(os.path.splitext(
unicode(self.getParameterValue(self.INPUT)))[0]))
arguments.append(unicode(self.getParameterValue(self.INPUT)))
arguments.append(unicode(self.getOutputValue(self.OUTPUT)))
GdalUtils.runGdal(['gdal_rasterize',
GdalUtils.escapeAndJoin(arguments)], progress)
示例4: processAlgorithm
# 需要导入模块: from processing.gdal.GdalUtils import GdalUtils [as 别名]
# 或者: from processing.gdal.GdalUtils.GdalUtils import runGdal [as 别名]
def processAlgorithm(self, progress):
arguments = ['-l']
arguments.append(
os.path.basename(os.path.splitext(
unicode(self.getParameterValue(self.INPUT)))[0]))
fieldName = self.getParameterValue(self.Z_FIELD)
if fieldName is not None and fieldName != '':
arguments.append('-zfield')
arguments.append(fieldName)
params = 'invdist'
params += ':power=%s' % self.getParameterValue(self.POWER)
params += ':smothing=%s' % self.getParameterValue(self.SMOTHING)
params += ':radius1=%s' % self.getParameterValue(self.RADIUS_1)
params += ':radius2=%s' % self.getParameterValue(self.RADIUS_2)
params += ':angle=%s' % self.getParameterValue(self.ANGLE)
params += ':max_points=%s' % self.getParameterValue(self.MAX_POINTS)
params += ':min_points=%s' % self.getParameterValue(self.MIN_POINTS)
params += ':nodata=%s' % self.getParameterValue(self.NODATA)
arguments.append('-a')
arguments.append(params)
arguments.append(unicode(self.getParameterValue(self.INPUT)))
arguments.append(unicode(self.getOutputValue(self.OUTPUT)))
GdalUtils.runGdal(['gdal_grid',
GdalUtils.escapeAndJoin(arguments)], progress)
示例5: processAlgorithm
# 需要导入模块: from processing.gdal.GdalUtils import GdalUtils [as 别名]
# 或者: from processing.gdal.GdalUtils.GdalUtils import runGdal [as 别名]
def processAlgorithm(self, progress):
out = self.getOutputValue(self.OUTPUT)
noData = str(self.getParameterValue(self.NO_DATA))
projwin = str(self.getParameterValue(self.PROJWIN))
extra = str(self.getParameterValue(self.EXTRA))
arguments = []
arguments.append("-of")
arguments.append(GdalUtils.getFormatShortNameFromFilename(out))
arguments.append("-a_nodata")
arguments.append(noData)
regionCoords = projwin.split(",")
arguments.append("-projwin")
arguments.append(regionCoords[0])
arguments.append(regionCoords[3])
arguments.append(regionCoords[1])
arguments.append(regionCoords[2])
if len(extra) > 0:
arguments.append(extra)
arguments.append(self.getParameterValue(self.INPUT))
arguments.append(out)
GdalUtils.runGdal(["gdal_translate", GdalUtils.escapeAndJoin(arguments)], progress)
示例6: processAlgorithm
# 需要导入模块: from processing.gdal.GdalUtils import GdalUtils [as 别名]
# 或者: from processing.gdal.GdalUtils.GdalUtils import runGdal [as 别名]
def processAlgorithm(self, progress):
output = self.getOutputValue(self.OUTPUT)
arguments = []
arguments.append("-md")
arguments.append(str(self.getParameterValue(self.DISTANCE)))
if self.getParameterValue(self.ITERATIONS) != 0:
arguments.append("-si")
arguments.append(str(self.getParameterValue(self.ITERATIONS)))
arguments.append("-b")
arguments.append(str(self.getParameterValue(self.BAND)))
mask = self.getParameterValue(self.MASK)
if mask is not None:
arguments.append("-mask")
arguments.append(mask)
if self.getParameterValue(self.NO_DEFAULT_MASK):
arguments.append("-nomask")
arguments.append("-of")
arguments.append(GdalUtils.getFormatShortNameFromFilename(output))
arguments.append(self.getParameterValue(self.INPUT))
arguments.append(output)
commands = []
if isWindows():
commands = ["cmd.exe", "/C ", "gdal_fillnodata.bat", GdalUtils.escapeAndJoin(arguments)]
else:
commands = ["gdal_fillnodata.py", GdalUtils.escapeAndJoin(arguments)]
GdalUtils.runGdal(commands, progress)
示例7: processAlgorithm
# 需要导入模块: from processing.gdal.GdalUtils import GdalUtils [as 别名]
# 或者: from processing.gdal.GdalUtils.GdalUtils import runGdal [as 别名]
def processAlgorithm(self, progress):
arguments = []
arguments.append('-s_srs')
arguments.append(str(self.getParameterValue(self.SOURCE_SRS)))
arguments.append('-t_srs')
crsId = self.getParameterValue(self.DEST_SRS)
self.crs = QgsCoordinateReferenceSystem(crsId)
arguments.append(str(crsId))
arguments.append('-r')
arguments.append(
self.METHOD_OPTIONS[self.getParameterValue(self.METHOD)])
arguments.append('-of')
out = self.getOutputValue(self.OUTPUT)
arguments.append(GdalUtils.getFormatShortNameFromFilename(out))
if self.getParameterValue(self.TR) != 0:
arguments.append('-tr')
arguments.append(str(self.getParameterValue(self.TR)))
arguments.append(str(self.getParameterValue(self.TR)))
extra = str(self.getParameterValue(self.EXTRA))
if len(extra) > 0:
arguments.append(extra)
arguments.append(self.getParameterValue(self.INPUT))
arguments.append(out)
GdalUtils.runGdal(['gdalwarp', GdalUtils.escapeAndJoin(arguments)],
progress)
示例8: processAlgorithm
# 需要导入模块: from processing.gdal.GdalUtils import GdalUtils [as 别名]
# 或者: from processing.gdal.GdalUtils.GdalUtils import runGdal [as 别名]
def processAlgorithm(self, progress):
inFile = self.getParameterValue(self.INPUT)
clearOverviews = self.getParameterValue(self.CLEAN)
ovrFormat = self.getParameterValue(self.FORMAT)
arguments = []
arguments.append(inFile)
if clearOverviews:
arguments.append('-clean')
arguments.append('-r')
arguments.append(
self.METHODS[self.getParameterValue(self.RESAMPLING_METHOD)])
if ovrFormat == 1:
# external .ovr
arguments.append('-ro')
elif ovrFormat == 2:
# external .aux
arguments.extend('--config USE_RRD YES'.split(' '))
arguments.extend(self.getParameterValue(self.LEVELS).split(' '))
self.setOutputValue(self.OUTPUT, inFile)
GdalUtils.runGdal(['gdaladdo', GdalUtils.escapeAndJoin(arguments)],
progress)
示例9: processAlgorithm
# 需要导入模块: from processing.gdal.GdalUtils import GdalUtils [as 别名]
# 或者: from processing.gdal.GdalUtils.GdalUtils import runGdal [as 别名]
def processAlgorithm(self, progress):
arguments = ['hillshade']
arguments.append(unicode(self.getParameterValue(self.INPUT)))
arguments.append(unicode(self.getOutputValue(self.OUTPUT)))
arguments.append('-b')
arguments.append(str(self.getParameterValue(self.BAND)))
arguments.append('-z')
arguments.append(str(self.getParameterValue(self.Z_FACTOR)))
arguments.append('-s')
arguments.append(str(self.getParameterValue(self.SCALE)))
arguments.append('-az')
arguments.append(str(self.getParameterValue(self.AZIMUTH)))
arguments.append('-alt')
arguments.append(str(self.getParameterValue(self.ALTITUDE)))
if self.getParameterValue(self.COMPUTE_EDGES):
arguments.append('-compute_edges')
if self.getParameterValue(self.ZEVENBERGEN):
arguments.append('-alg')
arguments.append('ZevenbergenThorne')
GdalUtils.runGdal(['gdaldem',
GdalUtils.escapeAndJoin(arguments)], progress)
示例10: processAlgorithm
# 需要导入模块: from processing.gdal.GdalUtils import GdalUtils [as 别名]
# 或者: from processing.gdal.GdalUtils.GdalUtils import runGdal [as 别名]
def processAlgorithm(self, progress):
arguments = []
inFile = self.getParameterValue(gdaladdo.INPUT)
arguments.append(inFile)
arguments.extend(self.getParameterValue(gdaladdo.LEVELS).split(" "))
self.setOutputValue(gdaladdo.OUTPUT, inFile)
GdalUtils.runGdal(["gdaladdo", GdalUtils.escapeAndJoin(arguments)], progress)
示例11: processAlgorithm
# 需要导入模块: from processing.gdal.GdalUtils import GdalUtils [as 别名]
# 或者: from processing.gdal.GdalUtils.GdalUtils import runGdal [as 别名]
def processAlgorithm(self, progress):
arguments = []
arguments.append("-o")
arguments.append(self.getOutputValue(nearblack.OUTPUT))
arguments.append("-near")
arguments.append(str(self.getParameterValue(nearblack.NEAR)))
if self.getParameterValue(nearblack.WHITE):
arguments.append("-white")
arguments.append(self.getParameterValue(nearblack.INPUT))
GdalUtils.runGdal(["nearblack", GdalUtils.escapeAndJoin(arguments)], progress)
示例12: processAlgorithm
# 需要导入模块: from processing.gdal.GdalUtils import GdalUtils [as 别名]
# 或者: from processing.gdal.GdalUtils.GdalUtils import runGdal [as 别名]
def processAlgorithm(self, progress):
arguments = ["TPI"]
arguments.append(unicode(self.getParameterValue(self.INPUT)))
arguments.append(unicode(self.getOutputValue(self.OUTPUT)))
arguments.append("-b")
arguments.append(str(self.getParameterValue(self.BAND)))
if self.getParameterValue(self.COMPUTE_EDGES):
arguments.append("-compute_edges")
GdalUtils.runGdal(["gdaldem", GdalUtils.escapeAndJoin(arguments)], progress)
示例13: processAlgorithm
# 需要导入模块: from processing.gdal.GdalUtils import GdalUtils [as 别名]
# 或者: from processing.gdal.GdalUtils.GdalUtils import runGdal [as 别名]
def processAlgorithm(self, progress):
arguments = ['roughness']
arguments.append(unicode(self.getParameterValue(self.INPUT)))
arguments.append(unicode(self.getOutputValue(self.OUTPUT)))
arguments.append('-b')
arguments.append(str(self.getParameterValue(self.BAND)))
if self.getParameterValue(self.COMPUTE_EDGES):
arguments.append('-compute_edges')
GdalUtils.runGdal(['gdaldem',
GdalUtils.escapeAndJoin(arguments)], progress)
示例14: processAlgorithm
# 需要导入模块: from processing.gdal.GdalUtils import GdalUtils [as 别名]
# 或者: from processing.gdal.GdalUtils.GdalUtils import runGdal [as 别名]
def processAlgorithm(self, progress):
arguments = []
if self.getParameterValue(information.NOGCP):
arguments.append("-nogcp")
if self.getParameterValue(information.NOMETADATA):
arguments.append("-nomd")
arguments.append(self.getParameterValue(information.INPUT))
GdalUtils.runGdal(["gdalinfo", GdalUtils.escapeAndJoin(arguments)], progress)
output = self.getOutputValue(information.OUTPUT)
f = open(output, "w")
for s in GdalUtils.getConsoleOutput()[1:]:
f.write("<p>" + str(s) + "</p>")
f.close()
示例15: processAlgorithm
# 需要导入模块: from processing.gdal.GdalUtils import GdalUtils [as 别名]
# 或者: from processing.gdal.GdalUtils.GdalUtils import runGdal [as 别名]
def processAlgorithm(self, progress):
arguments = []
if self.getParameterValue(information.NOGCP):
arguments.append('-nogcp')
if self.getParameterValue(information.NOMETADATA):
arguments.append('-nomd')
arguments.append(self.getParameterValue(information.INPUT))
GdalUtils.runGdal(['gdalinfo', GdalUtils.escapeAndJoin(arguments)],
progress)
output = self.getOutputValue(information.OUTPUT)
f = open(output, 'w')
for s in GdalUtils.getConsoleOutput()[1:]:
f.write('<p>' + str(s) + '</p>')
f.close()