<< Click to Display Table of Contents >>

 

Raster

 

 

Raster物件包含一個工具運行處理後的結果,和相關訊息。

Raster物件屬性

參數

說明

參數類型

bandCount (唯讀)

網格資料的波段數目

長整數

catalogPath (唯讀)

網格資料所在的目錄路徑

字串

extent (唯讀)

網格資料所在的範圍

extent

format (唯讀)

網格資料格式,為下列任一類型

1. BMP

2. DAT

3. GIF

4. IMAGINE

5. JP2000

6. JPEG

7. PNG

8. TIFF

9. ECW

10. LAN

11. GIS

12. SGR

13. MrSID

14. GeoTIFF

字串

height (唯讀)

網格資料的列數

長整數

maximum (唯讀)

網格資料中的最大值

雙精度浮點數

mean (唯讀)

網格資料的平均值

雙精度浮點數

meanCellHeight (唯讀)

網格每一cell ,y軸方向的長度大小

雙精度浮點數

meanCellWidth

(唯讀)

網格每一cell ,x軸方向的長度大小

雙精度浮點數

minimum (唯讀)

網格資料中的最小值

雙精度浮點數

name (唯讀)

網格資料的名稱

字串

noDataValue (唯讀)

網格資料中,代表NoData的值

雙精度浮點數

pixelType (唯讀)

網格pixel格式, 為下列任一類型

1. U1—1 bit

2. U2—2 bits

3. U4—4 bits

4. U8—Unsigned 8 bit integers

5. S8—8 bit integers

6. U16—Unsigned 16 bit integers

7. S16—16 bit integers

8. U32—Unsigned 32 bit integers

9. S32—32 bit integers

10. F32—Single precision floating point

11. F64—Double precision floating point

字串

spatialReference (唯讀)

網格資料的參考坐標系統

spatialReference

standardDeviation(唯讀)

網個資料的標準偏差

雙精度浮點數

uncompressedSize (唯讀)

網格資料的檔案大小

雙精度浮點數

width (唯讀)

網格資料的行數

長整數

Raster物件函數

類別函數

函數說明

save(name)

網格資料以特定名稱,儲存於硬碟中

Raster使用範例

import sgpy

# 取得tif網格資料

tif = sgpy.Raster("D:/Test Data/Raster/SG_t0.tif")

#列印網格資料說明資訊

print("Name: {0}".format(tif.name))

print("Format: {0}".format(tif.format))

print("Width,Height: {0},{1}".format(tif.width, tif.height))

print("BandCount: {0}".format(tif.bandCount))

print("PixelType: {0}".format(tif.pixelType))

print("UncompressedSize: {0} Bytes".format(tif.uncompressedSize))

print("***Raster Statistics***")

print("Min: {0}".format(tif.minimum))

print("Max: {0}".format(tif.maximum))

print("Mean: {0}".format(tif.mean))

print("Standard Deviation: {0}".format(tif.standardDeviation))

 


©2015 Supergeo Technologies Inc. All rights reserved.