2013-12-11 13 views

回答

0

我不太清楚你所指的是什麼像素數據,所以我會假設它是另一個可以用shapefile座標索引的數組。也許this article將幫助你提取多邊形的頂點(看起來你必須爲他用來做這件事的例行公事賺點錢)。如果你想獲得每個像素周圍的最大值,當你得到每個xy矢量索引到數據(pixel下面),你將不得不做一些dimensional juggling。像下面的東西可能會奏效,但我沒有測試它(你可能不得不與其上計算的最大尺寸打):

n = n_elements(x) 
; pixel = findgen(np, np) 

; Make a copy of "pixel" so we can eliminate the center element 
; from consideration of the maximum 
new_pixel = pixel 
new_pixel[x, y] = new_pixel[x + 1, y + 1] 

x = rebin(reform(x, n, 1), n, 9) 
y = rebin(reform(y, n, 1), n, 9) 

x += rebin(reform([-1, 0, 1], 1, 3), n, 9) 
y += rebin(reform(rebin(reform([-1, 0, 1], 3, 1), 3, 3), 1, 9), n, 9) 

; Get surrounding elements 
new_pixel = new_pixel[x, y] 
; Get maximum 
max_pixel = max(new_pixel, dimension=2) 
0

我強烈建議使用QGIS爲shape文件操作導入之前將矩陣索引轉換爲IDL。然後可以執行簡單的計算:

輸出=輸入[其中(指數當量shp_value)]

爲了對準的像素,從而在QGIS索引光柵時,我會寫shape文件值到現有的光柵。我相信你想要Rasterize工具。有關更多信息,請閱讀我的reply關於區域統計信息。

乾杯,

亞當

相關問題