當前位置: 首頁>>代碼示例>>Python>>正文


Python gdal.GMF_ALPHA屬性代碼示例

本文整理匯總了Python中osgeo.gdal.GMF_ALPHA屬性的典型用法代碼示例。如果您正苦於以下問題:Python gdal.GMF_ALPHA屬性的具體用法?Python gdal.GMF_ALPHA怎麽用?Python gdal.GMF_ALPHA使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在osgeo.gdal的用法示例。


在下文中一共展示了gdal.GMF_ALPHA屬性的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: nb_data_bands

# 需要導入模塊: from osgeo import gdal [as 別名]
# 或者: from osgeo.gdal import GMF_ALPHA [as 別名]
def nb_data_bands(dataset):
    """
    Return the number of data (non-alpha) bands of a gdal dataset
    """
    alphaband = dataset.GetRasterBand(1).GetMaskBand()
    if ((alphaband.GetMaskFlags() & gdal.GMF_ALPHA) or
            dataset.RasterCount == 4 or
            dataset.RasterCount == 2):
        return dataset.RasterCount - 1
    else:
        return dataset.RasterCount 
開發者ID:Luqqk,項目名稱:gdal2tiles,代碼行數:13,代碼來源:gdal2tiles.py

示例2: open_inumpyut

# 需要導入模塊: from osgeo import gdal [as 別名]
# 或者: from osgeo.gdal import GMF_ALPHA [as 別名]
def open_inumpyut(self,vrt):
        if vrt:
            self.in_ds = gdal.Open(vrt, gdal.GA_ReadOnly)
        else:
            raise Exception("No vrt file was specified")
            
        if self.options.verbose:
            print("Inumpyut file:", "( %sP x %sL - %s bands)" % (self.in_ds.RasterXSize, self.in_ds.RasterYSize, self.in_ds.RasterCount))

        if not self.in_ds:
            # Note: GDAL prints the ERROR message too
            self.error("It is not possible to open the inumpyut file '%s'." % vrt )
            
        if self.in_ds.RasterCount == 0:
            self.error( "Inumpyut file '%s' has no raster band" % vrt )
        
        self.out_ds = self.in_ds
        
        # Get alpha band (either directly or from NODATA value)
        self.alphaband = self.out_ds.GetRasterBand(1).GetMaskBand()
        if (self.alphaband.GetMaskFlags() & gdal.GMF_ALPHA) or self.out_ds.RasterCount==4 or self.out_ds.RasterCount==2:
            self.dataBandsCount = self.out_ds.RasterCount - 1
        else:
            self.dataBandsCount = self.out_ds.RasterCount

    # ------------------------------------------------------------------------- 
開發者ID:giohappy,項目名稱:gdal2cesium,代碼行數:28,代碼來源:gdal2cesium.py


注:本文中的osgeo.gdal.GMF_ALPHA屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。