إشعار: يجب
إثبات أهلية جميع المشاريع غير التجارية المسجّلة لاستخدام Earth Engine قبل
15 أبريل 2025 من أجل الحفاظ على إمكانية الوصول إلى Earth Engine.
ee.data.computePixels (Python only)
تنظيم صفحاتك في مجموعات
يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
تحسب هذه العملية مربّعًا من خلال إجراء عملية حسابية عشوائية على بيانات الصورة.
تعرض هذه السمة:
وحدات البكسل كبيانات صور أولية.
الاستخدام | المرتجعات |
ee.data.computePixels(params) | العنصر|القيمة |
الوسيطة | النوع | التفاصيل |
params | عنصر | كائن يحتوي على مَعلمات بالقيم المحتملة التالية:
expression - التعبير المطلوب حسابه.
fileFormat : تنسيق الملف الناتج. القيمة التلقائية هي png. راجِع
ImageFileFormat
للاطّلاع على التنسيقات المتاحة. تتوفّر تنسيقات إضافية تحوّل الكائن الذي تم تنزيله إلى كائن بيانات بلغة Python. وتشمل هذه السمة:
NUMPY_NDARRAY ، التي يتم تحويلها إلى مصفوفة NumPy منظَّمة.
grid - مَعلمات تصف شبكة وحدات البكسل التي سيتم استرداد البيانات منها.
يتم ضبط الإعداد التلقائي على شبكة البكسل الأصلية للبيانات.
bandIds : تحدّد هذه السمة، إذا كانت متوفّرة، مجموعة معيّنة من النطاقات التي يمكن الحصول منها على وحدات البكسل.
visualizationOptions - إذا كانت هذه السمة متوفّرة، فهي تمثّل مجموعة من خيارات العرض المرئي التي يمكن تطبيقها
لإنتاج عرض مرئي للبيانات باستخدام النموذج اللوني أحمر أخضر أزرق، 8 بت،
بدلاً من عرض البيانات الأولية.
workloadTag : علامة يقدّمها المستخدم لتتبُّع هذا الحساب. |
أمثلة
إعداد Python
راجِع صفحة
بيئة Python للحصول على معلومات حول واجهة برمجة التطبيقات Python واستخدام
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...
إنّ محتوى هذه الصفحة مرخّص بموجب ترخيص Creative Commons Attribution 4.0 ما لم يُنصّ على خلاف ذلك، ونماذج الرموز مرخّصة بموجب ترخيص Apache 2.0. للاطّلاع على التفاصيل، يُرجى مراجعة سياسات موقع Google Developers. إنّ Java هي علامة تجارية مسجَّلة لشركة Oracle و/أو شركائها التابعين.
تاريخ التعديل الأخير: 2025-07-26 (حسب التوقيت العالمي المتفَّق عليه)
[null,null,["تاريخ التعديل الأخير: 2025-07-26 (حسب التوقيت العالمي المتفَّق عليه)"],[[["\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```"]]