ee.data.computePixels (Python only)
קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
חישוב של משבצת על ידי ביצוע חישוב שרירותי על נתוני תמונה.
הערך שמוחזר:
הפיקסלים כנתוני תמונה גולמיים.
שימוש | החזרות |
ee.data.computePixels(params) | אובייקט|ערך |
ארגומנט | סוג | פרטים |
params | אובייקט | אובייקט שמכיל פרמטרים עם הערכים האפשריים הבאים:
expression – הביטוי לחישוב.
fileFormat – פורמט הקובץ שמתקבל. ברירת המחדל היא png. אפשר לעיין בImageFileFormat כדי לראות את הפורמטים הזמינים. יש פורמטים נוספים שממירים את האובייקט שהורד לאובייקט נתונים של Python. הם כוללים:
NUMPY_NDARRAY , שממיר למערך NumPy מובנה.
grid – פרמטרים שמתארים את רשת הפיקסלים שבה יתבצע אחזור הנתונים.
ברירת המחדל היא רשת הפיקסלים המקורית של הנתונים.
bandIds – אם קיים, מציין קבוצה ספציפית של פסים שממנה יתקבלו פיקסלים.
visualizationOptions – אם קיים, קבוצה של אפשרויות להצגה חזותית שאפשר להחיל כדי ליצור הצגה חזותית של הנתונים בפורמט RGB 8-ביט, במקום להחזיר את הנתונים הגולמיים.
workloadTag – תג שסופק על ידי המשתמש למעקב אחר החישוב הזה. |
דוגמאות
הגדרת Python
מידע על Python API ועל שימוש ב-geemap
לפיתוח אינטראקטיבי מופיע בדף
Python Environment.
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...
אלא אם צוין אחרת, התוכן של דף זה הוא ברישיון Creative Commons Attribution 4.0 ודוגמאות הקוד הן ברישיון Apache 2.0. לפרטים, ניתן לעיין במדיניות האתר Google Developers. Java הוא סימן מסחרי רשום של חברת Oracle ו/או של השותפים העצמאיים שלה.
עדכון אחרון: 2025-07-26 (שעון UTC).
[null,null,["עדכון אחרון: 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```"]]