当前位置: 首页>>代码示例>>Python>>正文


Python GdalUtils.getFormatShortNameFromFilename方法代码示例

本文整理汇总了Python中processing.gdal.GdalUtils.GdalUtils.getFormatShortNameFromFilename方法的典型用法代码示例。如果您正苦于以下问题:Python GdalUtils.getFormatShortNameFromFilename方法的具体用法?Python GdalUtils.getFormatShortNameFromFilename怎么用?Python GdalUtils.getFormatShortNameFromFilename使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在processing.gdal.GdalUtils.GdalUtils的用法示例。


在下文中一共展示了GdalUtils.getFormatShortNameFromFilename方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: processAlgorithm

# 需要导入模块: from processing.gdal.GdalUtils import GdalUtils [as 别名]
# 或者: from processing.gdal.GdalUtils.GdalUtils import getFormatShortNameFromFilename [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)
开发者ID:ChowZenki,项目名称:QGIS,代码行数:30,代码来源:ClipByMask.py

示例2: processAlgorithm

# 需要导入模块: from processing.gdal.GdalUtils import GdalUtils [as 别名]
# 或者: from processing.gdal.GdalUtils.GdalUtils import getFormatShortNameFromFilename [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)
开发者ID:AnAvidDeveloper,项目名称:QGIS,代码行数:28,代码来源:warp.py

示例3: processAlgorithm

# 需要导入模块: from processing.gdal.GdalUtils import GdalUtils [as 别名]
# 或者: from processing.gdal.GdalUtils.GdalUtils import getFormatShortNameFromFilename [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)
开发者ID:ChowZenki,项目名称:QGIS,代码行数:37,代码来源:fillnodata.py

示例4: processAlgorithm

# 需要导入模块: from processing.gdal.GdalUtils import GdalUtils [as 别名]
# 或者: from processing.gdal.GdalUtils.GdalUtils import getFormatShortNameFromFilename [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)
开发者ID:ChowZenki,项目名称:QGIS,代码行数:28,代码来源:ClipByExtent.py

示例5: processAlgorithm

# 需要导入模块: from processing.gdal.GdalUtils import GdalUtils [as 别名]
# 或者: from processing.gdal.GdalUtils.GdalUtils import getFormatShortNameFromFilename [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)
开发者ID:AnAvidDeveloper,项目名称:QGIS,代码行数:27,代码来源:sieve.py

示例6: processAlgorithm

# 需要导入模块: from processing.gdal.GdalUtils import GdalUtils [as 别名]
# 或者: from processing.gdal.GdalUtils.GdalUtils import getFormatShortNameFromFilename [as 别名]
    def processAlgorithm(self, progress):
        arguments = []
        arguments.append("-n")
        arguments.append(str(self.getParameterValue(rgb2pct.NCOLORS)))
        arguments.append("-of")
        out = self.getOutputValue(rgb2pct.OUTPUT)
        arguments.append(GdalUtils.getFormatShortNameFromFilename(out))
        arguments.append(self.getParameterValue(rgb2pct.INPUT))
        arguments.append(out)

        if isWindows():
            commands = ["cmd.exe", "/C ", "rgb2pct.bat", GdalUtils.escapeAndJoin(arguments)]
        else:
            commands = ["rgb2pct.py", GdalUtils.escapeAndJoin(arguments)]

        GdalUtils.runGdal(commands, progress)
开发者ID:dichapabe,项目名称:QGIS,代码行数:18,代码来源:rgb2pct.py

示例7: processAlgorithm

# 需要导入模块: from processing.gdal.GdalUtils import GdalUtils [as 别名]
# 或者: from processing.gdal.GdalUtils.GdalUtils import getFormatShortNameFromFilename [as 别名]
    def processAlgorithm(self, progress):
        out = self.getOutputValue(translate.OUTPUT)
        outsize = str(self.getParameterValue(self.OUTSIZE))
        outsizePerc = str(self.getParameterValue(self.OUTSIZE_PERC))
        noData = str(self.getParameterValue(self.NO_DATA))
        expand = str(self.getParameterFromName(
                self.EXPAND).options[self.getParameterValue(self.EXPAND)])
        projwin = str(self.getParameterValue(self.PROJWIN))
        crsId = self.getParameterValue(self.SRS)
        sds = self.getParameterValue(self.SDS)
        extra = str(self.getParameterValue(self.EXTRA))

        arguments = []
        arguments.append('-of')
        arguments.append(GdalUtils.getFormatShortNameFromFilename(out))
        if outsizePerc == 'True':
            arguments.append('-outsize')
            arguments.append(outsize + '%')
            arguments.append(outsize + '%')
        else:
            arguments.append('-outsize')
            arguments.append(outsize)
            arguments.append(outsize)
        arguments.append('-a_nodata')
        arguments.append(noData)
        if expand != 'none':
            arguments.append('-expand')
            arguments.append(expand)
        regionCoords = projwin.split(',')
        arguments.append('-projwin')
        arguments.append(regionCoords[0])
        arguments.append(regionCoords[3])
        arguments.append(regionCoords[1])
        arguments.append(regionCoords[2])
        if crsId is not None:
            arguments.append('-a_srs')
            arguments.append(str(crsId))
        if sds:
            arguments.append('-sds')
        if len(extra) > 0:
            arguments.append(extra)
        arguments.append(self.getParameterValue(self.INPUT))
        arguments.append(out)

        GdalUtils.runGdal(['gdal_translate',
                          GdalUtils.escapeAndJoin(arguments)], progress)
开发者ID:AnAvidDeveloper,项目名称:QGIS,代码行数:48,代码来源:translate.py

示例8: processAlgorithm

# 需要导入模块: from processing.gdal.GdalUtils import GdalUtils [as 别名]
# 或者: from processing.gdal.GdalUtils.GdalUtils import getFormatShortNameFromFilename [as 别名]
    def processAlgorithm(self, progress):
        arguments = []
        arguments.append("-b")
        arguments.append(str(self.getParameterValue(pct2rgb.NBAND) + 1))
        arguments.append("-of")
        out = self.getOutputValue(pct2rgb.OUTPUT)
        arguments.append(GdalUtils.getFormatShortNameFromFilename(out))
        arguments.append(self.getParameterValue(pct2rgb.INPUT))
        arguments.append(out)

        commands = []
        if ProcessingUtils.isWindows():
            commands = ["cmd.exe", "/C ", "pct2rgb.bat", GdalUtils.escapeAndJoin(arguments)]
        else:
            commands = ["pct2rgb.py", GdalUtils.escapeAndJoin(arguments)]

        GdalUtils.runGdal(commands, progress)
开发者ID:alextheleritis,项目名称:QGIS,代码行数:19,代码来源:pct2rgb.py

示例9: processAlgorithm

# 需要导入模块: from processing.gdal.GdalUtils import GdalUtils [as 别名]
# 或者: from processing.gdal.GdalUtils.GdalUtils import getFormatShortNameFromFilename [as 别名]
    def processAlgorithm(self, progress):
        arguments = []
        arguments.append('-b')
        arguments.append(str(self.getParameterValue(pct2rgb.NBAND) + 1))
        arguments.append('-of')
        out = self.getOutputValue(pct2rgb.OUTPUT)
        arguments.append(GdalUtils.getFormatShortNameFromFilename(out))
        arguments.append(self.getParameterValue(pct2rgb.INPUT))
        arguments.append(out)

        commands = []
        if isWindows():
            commands = ['cmd.exe', '/C ', 'pct2rgb.bat',
                        GdalUtils.escapeAndJoin(arguments)]
        else:
            commands = ['pct2rgb.py', GdalUtils.escapeAndJoin(arguments)]

        GdalUtils.runGdal(commands, progress)
开发者ID:AnAvidDeveloper,项目名称:QGIS,代码行数:20,代码来源:pct2rgb.py

示例10: processAlgorithm

# 需要导入模块: from processing.gdal.GdalUtils import GdalUtils [as 别名]
# 或者: from processing.gdal.GdalUtils.GdalUtils import getFormatShortNameFromFilename [as 别名]
    def processAlgorithm(self, progress):
        out = self.getOutputValue(translate.OUTPUT)
        outsize = str(self.getParameterValue(translate.OUTSIZE))
        outsizePerc = str(self.getParameterValue(translate.OUTSIZE_PERC))
        noData = str(self.getParameterValue(translate.NO_DATA))
        expand = str(self.getParameterFromName(translate.EXPAND).options[self.getParameterValue(translate.EXPAND)])
        projwin = str(self.getParameterValue(translate.PROJWIN))
        crsId = self.getParameterValue(translate.SRS)
        sds = self.getParameterValue(translate.SDS)
        extra = str(self.getParameterValue(translate.EXTRA))

        arguments = []
        arguments.append("-of")
        arguments.append(GdalUtils.getFormatShortNameFromFilename(out))
        if outsizePerc == "True":
            arguments.append("-outsize")
            arguments.append(outsize + "%")
            arguments.append(outsize + "%")
        else:
            arguments.append("-outsize")
            arguments.append(outsize)
            arguments.append(outsize)
        arguments.append("-a_nodata")
        arguments.append(noData)
        if expand != "none":
            arguments.append("-expand")
            arguments.append(expand)
        regionCoords = projwin.split(",")
        arguments.append("-projwin")
        arguments.append(regionCoords[0])
        arguments.append(regionCoords[3])
        arguments.append(regionCoords[1])
        arguments.append(regionCoords[2])
        if crsId is not None:
            arguments.append("-a_srs")
            arguments.append(str(crsId))
        if sds:
            arguments.append("-sds")
        if len(extra) > 0:
            arguments.append(extra)
        arguments.append(self.getParameterValue(translate.INPUT))
        arguments.append(out)

        GdalUtils.runGdal(["gdal_translate", GdalUtils.escapeAndJoin(arguments)], progress)
开发者ID:ChowZenki,项目名称:QGIS,代码行数:46,代码来源:translate.py

示例11: processAlgorithm

# 需要导入模块: from processing.gdal.GdalUtils import GdalUtils [as 别名]
# 或者: from processing.gdal.GdalUtils.GdalUtils import getFormatShortNameFromFilename [as 别名]
    def processAlgorithm(self, progress):
        output = self.getOutputValue(self.OUTPUT)

        arguments = []
        arguments.append(self.getParameterValue(self.INPUT))
        arguments.append(output)

        arguments.append('-of')
        arguments.append(GdalUtils.getFormatShortNameFromFilename(output))

        arguments.append('-distunits')
        arguments.append(self.DISTUNITS[self.getParameterValue(self.UNITS)])

        values = self.getParameterValue(self.VALUES)
        if len(values) > 0:
            arguments.append('-values')
            arguments.append(values)

        values = str(self.getParameterValue(self.MAX_DIST))
        if values < 0:
            arguments.append('-maxdist')
            arguments.append(values)

        values = str(self.getParameterValue(self.NODATA))
        if values < 0:
            arguments.append('-nodata')
            arguments.append(values)

        values = str(self.getParameterValue(self.BUF_VAL))
        if values < 0:
            arguments.append('-fixed-buf-val')
            arguments.append(values)

        commands = []
        if isWindows():
            commands = ['cmd.exe', '/C ', 'gdal_proximity.bat',
                        GdalUtils.escapeAndJoin(arguments)]
        else:
            commands = ['gdal_proximity.py',
                        GdalUtils.escapeAndJoin(arguments)]

        GdalUtils.runGdal(commands, progress)
开发者ID:jeffery9,项目名称:QGIS,代码行数:44,代码来源:proximity.py

示例12: processAlgorithm

# 需要导入模块: from processing.gdal.GdalUtils import GdalUtils [as 别名]
# 或者: from processing.gdal.GdalUtils.GdalUtils import getFormatShortNameFromFilename [as 别名]
    def processAlgorithm(self, progress):
        arguments = []
        if self.getParameterValue(merge.SEPARATE):
            arguments.append("-separate")
        if self.getParameterValue(merge.PCT):
            arguments.append("-pct")
        arguments.append("-o")
        out = self.getOutputValue(merge.OUTPUT)
        arguments.append(out)
        arguments.append("-of")
        arguments.append(GdalUtils.getFormatShortNameFromFilename(out))
        arguments.extend(self.getParameterValue(merge.INPUT).split(";"))

        commands = []
        if ProcessingUtils.isWindows():
            commands = ["cmd.exe", "/C ", "gdal_merge.bat", GdalUtils.escapeAndJoin(arguments)]
        else:
            commands = ["gdal_merge.py", GdalUtils.escapeAndJoin(arguments)]

        GdalUtils.runGdal(commands, progress)
开发者ID:alextheleritis,项目名称:QGIS,代码行数:22,代码来源:merge.py

示例13: processAlgorithm

# 需要导入模块: from processing.gdal.GdalUtils import GdalUtils [as 别名]
# 或者: from processing.gdal.GdalUtils.GdalUtils import getFormatShortNameFromFilename [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)
        keepResolution = self.getParameterValue(self.KEEP_RESOLUTION)
        extra = str(self.getParameterValue(self.EXTRA))

        arguments = []
        arguments.append('-q')
        arguments.append('-of')
        arguments.append(GdalUtils.getFormatShortNameFromFilename(out))
        arguments.append('-dstnodata')
        arguments.append(noData)

        if keepResolution:
            r = gdal.Open(self.getParameterValue(self.INPUT))
            geoTransform = r.GetGeoTransform()
            r = None
            arguments.append('-tr')
            arguments.append(str(geoTransform[1]))
            arguments.append(str(geoTransform[5]))
            arguments.append('-tap')

        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)
开发者ID:FlavioFalcao,项目名称:QGIS,代码行数:41,代码来源:ClipByMask.py

示例14: int

# 需要导入模块: from processing.gdal.GdalUtils import GdalUtils [as 别名]
# 或者: from processing.gdal.GdalUtils.GdalUtils import getFormatShortNameFromFilename [as 别名]
try:
    from osgeo import gdal, ogr
except ImportError:
    import gdal
    import ogr

threshold = int(threshold)
connectedness=int(connectedness)
options = []

src_ds = gdal.Open( src_filename, gdal.GA_ReadOnly )
srcband = src_ds.GetRasterBand(1)
maskband = srcband.GetMaskBand()

drv = gdal.GetDriverByName(GdalUtils.getFormatShortNameFromFilename(dst_filename))
dst_ds = drv.Create( dst_filename,src_ds.RasterXSize, src_ds.RasterYSize,1,
                         srcband.DataType )
wkt = src_ds.GetProjection()
if wkt != '':
    dst_ds.SetProjection( wkt )
dst_ds.SetGeoTransform( src_ds.GetGeoTransform() )
dstband = dst_ds.GetRasterBand(1)

prog_func = gdal.TermProgress

result = gdal.SieveFilter( srcband, maskband, dstband,
                           threshold, connectedness,
                           callback = prog_func )

src_ds = None
开发者ID:alextheleritis,项目名称:QGIS,代码行数:32,代码来源:sieve.py


注:本文中的processing.gdal.GdalUtils.GdalUtils.getFormatShortNameFromFilename方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。