إشعار: يجب
إثبات أهلية جميع المشاريع غير التجارية المسجّلة لاستخدام Earth Engine قبل
15 أبريل 2025 من أجل الحفاظ على إمكانية الوصول إلى Earth Engine.
ee.ImageCollection.sort
تنظيم صفحاتك في مجموعات
يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
ترتيب مجموعة حسب السمة المحدّدة
تعرض هذه الدالة المجموعة المصنّفة.
الاستخدام | المرتجعات |
---|
ImageCollection.sort(property, ascending) | مجموعة |
الوسيطة | النوع | التفاصيل |
---|
هذا: collection | مجموعة | مثيل المجموعة |
property | سلسلة | السمة التي سيتم الترتيب حسبها |
ascending | قيمة منطقية، اختيارية | لتحديد ما إذا كان سيتم الترتيب تصاعديًا أو تنازليًا القيمة التلقائية هي "صحيح" (ترتيب تصاعدي). |
أمثلة
محرّر الرموز البرمجية (JavaScript)
// A Landsat 8 TOA image collection (2 months of images at a specific point).
var col = ee.ImageCollection('LANDSAT/LC08/C02/T1_TOA')
.filterBounds(ee.Geometry.Point(-90.70, 34.71))
.filterDate('2020-07-01', '2020-09-01');
print('Collection', col);
// Sort the collection in ASCENDING order of image cloud cover.
var colCldSortAsc = col.sort('CLOUD_COVER');
print('Cloud cover ascending', colCldSortAsc);
// Display the image with the least cloud cover.
var visParams = {
bands: ['B4', 'B3', 'B2'],
min: 0.01,
max: 0.25
};
Map.setCenter(-90.70, 34.71, 9);
Map.addLayer(colCldSortAsc.first(), visParams, 'Least cloudy');
// Sort the collection in DESCENDING order of image cloud cover.
var colCldSortDesc = col.sort('CLOUD_COVER', false);
print('Cloud cover descending', colCldSortDesc);
// Display the image with the most cloud cover.
Map.addLayer(colCldSortDesc.first(), visParams, 'Most cloudy');
إعداد Python
راجِع صفحة
بيئة Python للحصول على معلومات حول واجهة برمجة التطبيقات Python واستخدام
geemap
للتطوير التفاعلي.
import ee
import geemap.core as geemap
Colab (Python)
# A Landsat 8 TOA image collection (2 months of images at a specific point).
col = (
ee.ImageCollection('LANDSAT/LC08/C02/T1_TOA')
.filterBounds(ee.Geometry.Point(-90.70, 34.71))
.filterDate('2020-07-01', '2020-09-01')
)
display('Collection', col)
# Sort the collection in ASCENDING order of image cloud cover.
col_cld_sort_asc = col.sort('CLOUD_COVER')
display('Cloud cover ascending', col_cld_sort_asc)
# Display the image with the least cloud cover.
vis_params = {'bands': ['B4', 'B3', 'B2'], 'min': 0.01, 'max': 0.25}
m = geemap.Map()
m.set_center(-90.70, 34.71, 9)
m.add_layer(col_cld_sort_asc.first(), vis_params, 'Least cloudy')
# Sort the collection in DESCENDING order of image cloud cover.
col_cld_sort_desc = col.sort('CLOUD_COVER', False)
display('Cloud cover descending', col_cld_sort_desc)
# Display the image with the most cloud cover.
m.add_layer(col_cld_sort_desc.first(), vis_params, 'Most cloudy')
m
إنّ محتوى هذه الصفحة مرخّص بموجب ترخيص Creative Commons Attribution 4.0 ما لم يُنصّ على خلاف ذلك، ونماذج الرموز مرخّصة بموجب ترخيص Apache 2.0. للاطّلاع على التفاصيل، يُرجى مراجعة سياسات موقع Google Developers. إنّ Java هي علامة تجارية مسجَّلة لشركة Oracle و/أو شركائها التابعين.
تاريخ التعديل الأخير: 2025-07-29 (حسب التوقيت العالمي المتفَّق عليه)
[null,null,["تاريخ التعديل الأخير: 2025-07-29 (حسب التوقيت العالمي المتفَّق عليه)"],[[["\u003cp\u003eThe \u003ccode\u003esort()\u003c/code\u003e method allows you to order an ImageCollection based on a specified property, such as cloud cover.\u003c/p\u003e\n"],["\u003cp\u003eBy default, \u003ccode\u003esort()\u003c/code\u003e arranges the collection in ascending order; to sort in descending order, set the \u003ccode\u003eascending\u003c/code\u003e parameter to \u003ccode\u003efalse\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThis method is useful for tasks like identifying images with the least or most cloud cover within a collection.\u003c/p\u003e\n"],["\u003cp\u003eThe sorted collection is returned, enabling further processing or analysis.\u003c/p\u003e\n"]]],[],null,["# ee.ImageCollection.sort\n\n\u003cbr /\u003e\n\nSort a collection by the specified property.\n\n\u003cbr /\u003e\n\nReturns the sorted collection.\n\n| Usage | Returns |\n|-------------------------------------------------|------------|\n| ImageCollection.sort`(property, `*ascending*`)` | Collection |\n\n| Argument | Type | Details |\n|--------------------|-------------------|------------------------------------------------------------------------------------|\n| this: `collection` | Collection | The Collection instance. |\n| `property` | String | The property to sort by. |\n| `ascending` | Boolean, optional | Whether to sort in ascending or descending order. The default is true (ascending). |\n\nExamples\n--------\n\n### Code Editor (JavaScript)\n\n```javascript\n// A Landsat 8 TOA image collection (2 months of images at a specific point).\nvar col = ee.ImageCollection('LANDSAT/LC08/C02/T1_TOA')\n .filterBounds(ee.Geometry.Point(-90.70, 34.71))\n .filterDate('2020-07-01', '2020-09-01');\nprint('Collection', col);\n\n// Sort the collection in ASCENDING order of image cloud cover.\nvar colCldSortAsc = col.sort('CLOUD_COVER');\nprint('Cloud cover ascending', colCldSortAsc);\n\n// Display the image with the least cloud cover.\nvar visParams = {\n bands: ['B4', 'B3', 'B2'],\n min: 0.01,\n max: 0.25\n};\nMap.setCenter(-90.70, 34.71, 9);\nMap.addLayer(colCldSortAsc.first(), visParams, 'Least cloudy');\n\n// Sort the collection in DESCENDING order of image cloud cover.\nvar colCldSortDesc = col.sort('CLOUD_COVER', false);\nprint('Cloud cover descending', colCldSortDesc);\n\n// Display the image with the most cloud cover.\nMap.addLayer(colCldSortDesc.first(), visParams, 'Most cloudy');\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# A Landsat 8 TOA image collection (2 months of images at a specific point).\ncol = (\n ee.ImageCollection('LANDSAT/LC08/C02/T1_TOA')\n .filterBounds(ee.Geometry.Point(-90.70, 34.71))\n .filterDate('2020-07-01', '2020-09-01')\n)\ndisplay('Collection', col)\n\n# Sort the collection in ASCENDING order of image cloud cover.\ncol_cld_sort_asc = col.sort('CLOUD_COVER')\ndisplay('Cloud cover ascending', col_cld_sort_asc)\n\n# Display the image with the least cloud cover.\nvis_params = {'bands': ['B4', 'B3', 'B2'], 'min': 0.01, 'max': 0.25}\nm = geemap.Map()\nm.set_center(-90.70, 34.71, 9)\nm.add_layer(col_cld_sort_asc.first(), vis_params, 'Least cloudy')\n\n# Sort the collection in DESCENDING order of image cloud cover.\ncol_cld_sort_desc = col.sort('CLOUD_COVER', False)\ndisplay('Cloud cover descending', col_cld_sort_desc)\n\n# Display the image with the most cloud cover.\nm.add_layer(col_cld_sort_desc.first(), vis_params, 'Most cloudy')\nm\n```"]]