rasterio
rasterio是一款非常便捷的柵格(影像)資料處理庫,非常適合按照自定義模式進行資料處理和展示的工作。
以讀取的方式開啟資料集
import rasterio as rio
dataset=rio.open(『exsample.tif』)
檢視資料集相關資訊(不用注釋了,都能看懂)
dataset.name
dataset.shape
dataset.bounds
dataset.width
dataset.height
dataset.count
dataset.bounds
dataset.crs;datset座標系
以寫入方式開啟檔案
要將此陣列和地理配準資訊一起儲存到新的柵格資料檔案中,請呼叫rasterio.open()要建立的新檔案的路徑, 'w』以指定寫入模式和幾個關鍵字引數。
driver:所需格式驅動程式的名稱
width:資料集的列數
height:資料集的行數
count:資料集帶的計數
dtype:資料集的資料型別
crs:座標參考系統識別符號或描述
transform:仿射變換矩陣
nodata:「 nodata」值
這些關鍵字引數的前5個引數化資料檔案的固定格式特定屬性,並且在開啟要寫入的檔案時是必需的。後三個是可選的。
with rio.
open
('new1.tif'
,'w'
, driver=
'gtiff'
, height=z.shape[0]
, width=z.shape[1]
, count=1,
dtype=z.dtype,
crs=
'+proj=latlong'
, transform=transform,
)as dst:
dst.write(z,
1)
python讀寫tiff遙感影像資料
from osgeo import gdal 讀影象檔案 defread img filename dataset gdal.open filename 開啟檔案 im width dataset.rasterxsize 柵格矩陣的列數 im height dataset.rasterysize 柵...
ArcGIS柵格影像背景顏色去除
明明背景值是nodata,為什麼還會顯示顏色 1 關於 忽略背景值 與 nodata值 的解釋說明 前者指背景像元的值是多少,它們將被看作為nodata,而後者就是nodata的實際儲存值。對於基於檔案的柵格資料集或個人地理資料庫 mdb 而言,就要找到未被使用的值來記錄nodata,解決辦法是將畫...
柵格 ArcGIS中遙感影像去除黑邊方法
方法 柵格計算器 raster calculator 方法一 勾上display background value rgb 方法二 在 image analysis 視窗中的 processing 部分可以對當前資料框中的圖層賦予mask function函式或函式鏈,從而對柵格資料實時處理。方法三...