Duyuru:
15 Nisan 2025'ten önce Earth Engine'i kullanmak için kaydedilen tüm ticari olmayan projelerin Earth Engine erişimini sürdürmek için
ticari olmayan uygunluğu doğrulaması gerekir.
ee.data.computePixels (Python only)
Koleksiyonlar ile düzeninizi koruyun
İçeriği tercihlerinize göre kaydedin ve kategorilere ayırın.
Görüntü verileri üzerinde rastgele bir hesaplama yaparak bir döşeme hesaplar.
Döndürülen değer:
Pikseller, ham görüntü verileri olarak.
Kullanım | İadeler |
ee.data.computePixels(params) | Nesne|Değer |
Bağımsız Değişken | Tür | Ayrıntılar |
params | Nesne | Aşağıdaki olası değerlere sahip parametreleri içeren bir nesne:
expression - Hesaplanacak ifade.
fileFormat - Ortaya çıkan dosya biçimi. Varsayılan olarak png değerine ayarlanır. Kullanılabilir biçimler için
ImageFileFormat
bölümüne bakın. İndirilen nesneyi Python veri nesnesine dönüştüren ek biçimler vardır. Bunlar arasında:
Yapılandırılmış bir NumPy dizisine dönüştürülen NUMPY_NDARRAY yer alır.
grid - Verilerin getirileceği piksel ızgarasını açıklayan parametreler.
Varsayılan olarak verilerin doğal piksel ızgarası kullanılır.
bandIds : Varsa piksellerin alınacağı belirli bir bant kümesini belirtir.
visualizationOptions - Varsa verilerin ham halini döndürmek yerine, 8 bit RGB görselleştirme oluşturmak için uygulanacak bir dizi görselleştirme seçeneği.
workloadTag - Bu hesaplamayı izlemek için kullanıcı tarafından sağlanan etiket. |
Örnekler
Python kurulumu
Python API'si ve etkileşimli geliştirme için geemap
kullanımı hakkında bilgi edinmek üzere
Python Ortamı sayfasına bakın.
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...
Aksi belirtilmediği sürece bu sayfanın içeriği Creative Commons Atıf 4.0 Lisansı altında ve kod örnekleri Apache 2.0 Lisansı altında lisanslanmıştır. Ayrıntılı bilgi için Google Developers Site Politikaları'na göz atın. Java, Oracle ve/veya satış ortaklarının tescilli ticari markasıdır.
Son güncelleme tarihi: 2025-07-26 UTC.
[null,null,["Son güncelleme tarihi: 2025-07-26 UTC."],[[["\u003cp\u003e\u003ccode\u003eee.data.computePixels\u003c/code\u003e computes a tile by performing an arbitrary computation on image data and returns the pixels as raw image data.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eparams\u003c/code\u003e argument to \u003ccode\u003eee.data.computePixels\u003c/code\u003e allows for customizing the computation through an expression, file format, pixel grid, band selection, visualization options, and workload tag.\u003c/p\u003e\n"],["\u003cp\u003eThe provided Python example demonstrates using \u003ccode\u003eee.data.computePixels\u003c/code\u003e to retrieve a PNG image tile from a Sentinel-2 median composite with specified visualization and grid parameters.\u003c/p\u003e\n"]]],[],null,["# ee.data.computePixels (Python only)\n\n\u003cbr /\u003e\n\nComputes a tile by performing an arbitrary computation on image data.\n\n\u003cbr /\u003e\n\nReturns:\nThe pixels as raw image data.\n\n| Usage | Returns |\n|---------------------------------|---------------|\n| `ee.data.computePixels(params)` | Object\\|Value |\n\n| Argument | Type | Details |\n|----------|--------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `params` | Object | An object containing parameters with the following possible values: `expression` - The expression to compute. `fileFormat` - The resulting file format. Defaults to png. See [ImageFileFormat](https://developers.google.com/earth-engine/reference/rest/v1/ImageFileFormat) for the available formats. There are additional formats that convert the downloaded object to a Python data object. These include: `NUMPY_NDARRAY`, which converts to a structured NumPy array. `grid` - Parameters describing the pixel grid in which to fetch data. Defaults to the native pixel grid of the data. `bandIds` - If present, specifies a specific set of bands from which to get pixels. `visualizationOptions` - If present, a set of visualization options to apply to produce an 8-bit RGB visualization of the data, rather than returning the raw data. `workloadTag` - User supplied tag to track this computation. |\n\nExamples\n--------\n\nPython setup\n\nSee the [Python Environment](/earth-engine/guides/python_install) page for information on the Python API and using\n`geemap` for interactive development. \n\n```python\nimport ee\nimport geemap.core as geemap\n```\n\n### Colab (Python)\n\n```python\n# Region of interest.\ncoords = [\n -121.58626826832939,\n 38.059141484827485,\n]\nregion = ee.Geometry.Point(coords)\n\n# Sentinel-2 median composite.\nimage = (ee.ImageCollection('COPERNICUS/S2')\n .filterBounds(region)\n .filterDate('2020-04-01', '2020-09-01')\n .median())\n\n# Make a projection to discover the scale in degrees.\nproj = ee.Projection('EPSG:4326').atScale(10).getInfo()\n\n# Get scales out of the transform.\nscale_x = proj['transform'][0]\nscale_y = -proj['transform'][4]\n\n# Make a request object.\nrequest = {\n 'expression': image,\n 'fileFormat': 'PNG',\n 'bandIds': ['B4', 'B3', 'B2'],\n 'grid': {\n 'dimensions': {\n 'width': 640,\n 'height': 640\n },\n 'affineTransform': {\n 'scaleX': scale_x,\n 'shearX': 0,\n 'translateX': coords[0],\n 'shearY': 0,\n 'scaleY': scale_y,\n 'translateY': coords[1]\n },\n 'crsCode': proj['crs'],\n },\n 'visualizationOptions': {'ranges': [{'min': 0, 'max': 3000}]},\n}\n\nimage_png = ee.data.computePixels(request)\n# Do something with the image...\n```"]]