ee.ImageCollection.first
با مجموعهها، منظم بمانید
ذخیره و طبقهبندی محتوا براساس اولویتهای شما.
اولین ورودی را از یک مجموعه داده شده برمی گرداند.
استفاده | برمی گرداند | ImageCollection. first () | تصویر |
استدلال | تایپ کنید | جزئیات | این: imagecollection | ImageCollection | نمونه ImageCollection. |
نمونه ها
ویرایشگر کد (جاوا اسکریپت)
var image = ee.ImageCollection('COPERNICUS/S2_SR').first();
Map.centerObject(image, 8);
var vis = {bands: ['B4', 'B3', 'B2'], min: 0, max: 5000};
Map.addLayer(image, vis, 'first of S2_SR');
// Display the image metadata.
print(image);
راه اندازی پایتون
برای اطلاعات در مورد API پایتون و استفاده از geemap
برای توسعه تعاملی به صفحه محیط پایتون مراجعه کنید.
import ee
import geemap.core as geemap
کولب (پایتون)
image = ee.ImageCollection('COPERNICUS/S2_SR').first()
m = geemap.Map()
m.center_object(image, 8)
vis = {'bands': ['B4', 'B3', 'B2'], 'min': 0, 'max': 5000}
m.add_layer(image, vis, 'first of S2_SR')
display(m)
# Display the image metadata.
display(image)
،
اولین ورودی را از یک مجموعه داده شده برمی گرداند.
استفاده | برمی گرداند | ImageCollection. first () | تصویر |
استدلال | تایپ کنید | جزئیات | این: imagecollection | ImageCollection | نمونه ImageCollection. |
نمونه ها
ویرایشگر کد (جاوا اسکریپت)
var image = ee.ImageCollection('COPERNICUS/S2_SR').first();
Map.centerObject(image, 8);
var vis = {bands: ['B4', 'B3', 'B2'], min: 0, max: 5000};
Map.addLayer(image, vis, 'first of S2_SR');
// Display the image metadata.
print(image);
راه اندازی پایتون
برای اطلاعات در مورد API پایتون و استفاده از geemap
برای توسعه تعاملی به صفحه محیط پایتون مراجعه کنید.
import ee
import geemap.core as geemap
کولب (پایتون)
image = ee.ImageCollection('COPERNICUS/S2_SR').first()
m = geemap.Map()
m.center_object(image, 8)
vis = {'bands': ['B4', 'B3', 'B2'], 'min': 0, 'max': 5000}
m.add_layer(image, vis, 'first of S2_SR')
display(m)
# Display the image metadata.
display(image)
جز در مواردی که غیر از این ذکر شده باشد،محتوای این صفحه تحت مجوز Creative Commons Attribution 4.0 License است. نمونه کدها نیز دارای مجوز Apache 2.0 License است. برای اطلاع از جزئیات، به خطمشیهای سایت Google Developers مراجعه کنید. جاوا علامت تجاری ثبتشده Oracle و/یا شرکتهای وابسته به آن است.
تاریخ آخرین بهروزرسانی 2025-07-24 بهوقت ساعت هماهنگ جهانی.
[null,null,["تاریخ آخرین بهروزرسانی 2025-07-24 بهوقت ساعت هماهنگ جهانی."],[[["\u003cp\u003eThe \u003ccode\u003efirst()\u003c/code\u003e function retrieves the first image from an ImageCollection in Earth Engine.\u003c/p\u003e\n"],["\u003cp\u003eIt can be applied to any ImageCollection, like the 'COPERNICUS/S2_SR' dataset shown in the examples.\u003c/p\u003e\n"],["\u003cp\u003eUsers can then visualize and analyze this single image, displaying its metadata or adding it as a layer to a map.\u003c/p\u003e\n"],["\u003cp\u003eThe provided code demonstrates using \u003ccode\u003efirst()\u003c/code\u003e in both JavaScript and Python environments within the Google Earth Engine Code Editor and Colab.\u003c/p\u003e\n"]]],["The provided content describes the `.first()` method for an ImageCollection, which retrieves the initial Image within that collection. In JavaScript and Python examples, it's demonstrated by selecting the first image from the 'COPERNICUS/S2_SR' ImageCollection. The code then centers the map on this image, sets visualization parameters, displays it on the map, and prints the image's metadata. This method only takes the ImageCollection instance as input.\n"],null,["# ee.ImageCollection.first\n\n\u003cbr /\u003e\n\nReturns the first entry from a given collection.\n\n\u003cbr /\u003e\n\n| Usage | Returns |\n|---------------------------|---------|\n| ImageCollection.first`()` | Image |\n\n| Argument | Type | Details |\n|-------------------------|-----------------|-------------------------------|\n| this: `imagecollection` | ImageCollection | The ImageCollection instance. |\n\nExamples\n--------\n\n### Code Editor (JavaScript)\n\n```javascript\nvar image = ee.ImageCollection('COPERNICUS/S2_SR').first();\nMap.centerObject(image, 8);\nvar vis = {bands: ['B4', 'B3', 'B2'], min: 0, max: 5000};\nMap.addLayer(image, vis, 'first of S2_SR');\n\n// Display the image metadata.\nprint(image);\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\nimage = ee.ImageCollection('COPERNICUS/S2_SR').first()\nm = geemap.Map()\nm.center_object(image, 8)\nvis = {'bands': ['B4', 'B3', 'B2'], 'min': 0, 'max': 5000}\nm.add_layer(image, vis, 'first of S2_SR')\ndisplay(m)\n\n# Display the image metadata.\ndisplay(image)\n```"]]