公告:凡是在
2025 年 4 月 15 日前註冊使用 Earth Engine 的非商業專案,都必須
驗證非商業用途資格,才能繼續存取。如未在 2025 年 9 月 26 日前完成驗證,存取權可能會暫停。
ee.data.computePixels (Python only)
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
對圖片資料執行任意計算,藉此計算圖塊。
傳回:
以原始圖片資料形式傳回像素。
用量 | 傳回 |
ee.data.computePixels(params) | 物件|值 |
引數 | 類型 | 詳細資料 |
params | 物件 | 物件,內含下列可能值的參數:
expression - 要計算的運算式。
fileFormat :產生的檔案格式。預設值為 png。如需可用格式,請參閱「ImageFileFormat」。此外,還有其他格式可將下載的物件轉換為 Python 資料物件。包括:
NUMPY_NDARRAY ,可轉換為結構化 NumPy 陣列。
grid - 描述要擷取資料的像素格線的參數。
預設為資料的原生像素格線。
bandIds - 如有,則指定要從中取得像素的特定頻帶組合。
visualizationOptions - 如果存在,則為一組要套用的視覺化選項,用來產生資料的 8 位元 RGB 視覺化結果,而不是傳回原始資料。
workloadTag - 使用者提供的標記,用於追蹤這項運算。 |
範例
Python 設定
請參閱
Python 環境頁面,瞭解 Python API 和如何使用 geemap
進行互動式開發。
import ee
import geemap.core as geemap
Colab (Python)
# Region of interest.
coords = [
-121.58626826832939,
38.059141484827485,
]
region = ee.Geometry.Point(coords)
# Sentinel-2 median composite.
image = (ee.ImageCollection('COPERNICUS/S2')
.filterBounds(region)
.filterDate('2020-04-01', '2020-09-01')
.median())
# Make a projection to discover the scale in degrees.
proj = ee.Projection('EPSG:4326').atScale(10).getInfo()
# Get scales out of the transform.
scale_x = proj['transform'][0]
scale_y = -proj['transform'][4]
# Make a request object.
request = {
'expression': image,
'fileFormat': 'PNG',
'bandIds': ['B4', 'B3', 'B2'],
'grid': {
'dimensions': {
'width': 640,
'height': 640
},
'affineTransform': {
'scaleX': scale_x,
'shearX': 0,
'translateX': coords[0],
'shearY': 0,
'scaleY': scale_y,
'translateY': coords[1]
},
'crsCode': proj['crs'],
},
'visualizationOptions': {'ranges': [{'min': 0, 'max': 3000}]},
}
image_png = ee.data.computePixels(request)
# Do something with the image...
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-07-26 (世界標準時間)。
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["缺少我需要的資訊","missingTheInformationINeed","thumb-down"],["過於複雜/步驟過多","tooComplicatedTooManySteps","thumb-down"],["過時","outOfDate","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["示例/程式碼問題","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-07-26 (世界標準時間)。"],[],[]]