با مجموعهها، منظم بمانید
ذخیره و طبقهبندی محتوا براساس اولویتهای شما.
مجموعه تصاویر به مجموعه ای از تصاویر Earth Engine اشاره دارد. به عنوان مثال، مجموعه تمام تصاویر Landsat 8 یک ee.ImageCollection است. مانند تصویر SRTM که با آن کار کردهاید، مجموعههای تصویر نیز دارای شناسه هستند. همانند تصاویر منفرد، میتوانید با جستجوی کاتالوگ دادههای Earth Engine از ویرایشگر کد و مشاهده صفحه جزئیات مجموعه داده، شناسه یک مجموعه تصویر را کشف کنید. به عنوان مثال، "landsat 8 toa" را جستجو کنید و روی اولین نتیجه کلیک کنید، که باید با مجموعه داده USGS Landsat 8 Collection 1 Tier 1 TOA Reflectance مطابقت داشته باشد. یا آن مجموعه داده را با استفاده از دکمه Import وارد کنید و نام آن را به l8 تغییر دهید، یا شناسه را در سازنده مجموعه تصویر کپی کنید:
شایان ذکر است که این مجموعه نمایانگر تمام صحنه های Landsat 8 جمع آوری شده در سراسر زمین است. اغلب استخراج یک تصویر منفرد یا زیر مجموعه ای از تصاویر برای آزمایش الگوریتم ها مفید است. راه محدود کردن مجموعه بر اساس زمان یا مکان، فیلتر کردن آن است. به عنوان مثال، برای فیلتر کردن مجموعه به تصاویری که یک مکان خاص را پوشش میدهند، ابتدا منطقه مورد نظر خود را با یک نقطه (یا خط یا چندضلعی) با استفاده از ابزار ترسیم هندسه تعریف کنید. به منطقه مورد علاقه خود حرکت کنید، روی هندسه وارد کنید (اگر قبلاً یک یا چند هندسه تعریف کرده اید) و لایه +جدید را کلیک کنید (اگر هیچ وارداتی ندارید، به مرحله بعدی بروید). ابزار ترسیم نقطه را دریافت کنید ( ) و در حوزه مورد علاقه خود نکته ای را بیان کنید. point واردات را نام ببرید. اکنون مجموعه l8 را فیلتر کنید تا فقط تصاویری که نقطه را قطع می کنند به دست آورید، سپس یک فیلتر دوم اضافه کنید تا مجموعه را فقط به تصاویری که در سال 2015 به دست آمده اند محدود کنید:
در اینجا، filterBounds() و filterDate() متدهای میانبر برای متد کلیتر filter() در مجموعه های تصویری هستند که یک ee.Filter() را به عنوان آرگومان خود می گیرد. برای کسب اطلاعات بیشتر در مورد این روش ها، برگه Docs در ویرایشگر کد را کاوش کنید. آرگومان filterBounds() نقطه ای است که شما دیجیتالی کردید و آرگومان های filterDate() دو تاریخ هستند که به صورت رشته بیان می شوند.
توجه داشته باشید که می توانید مجموعه های فیلتر شده print() . شما نمی توانید بیش از 5000 مورد را همزمان چاپ کنید، بنابراین نمی توانید برای مثال کل مجموعه l8 را چاپ کنید. پس از اجرای متد print() می توانید مجموعه های چاپ شده را در کنسول بررسی کنید. توجه داشته باشید که وقتی ImageCollection را با استفاده از zippy ( ، سپس لیست features را گسترش دهید، لیستی از تصاویر را مشاهده خواهید کرد که هر کدام را نیز می توان گسترش داد و بازرسی کرد. این یک راه برای کشف شناسه یک تصویر فردی است. یکی دیگر از راههای برنامهریزیشده برای بهدستآوردن تصاویر منفرد برای تجزیه و تحلیل، مرتبسازی مجموعه بهمنظور دریافت جدیدترین، قدیمیترین یا بهینهترین تصویر نسبت به برخی ویژگیهای ابرداده است. برای مثال، با بررسی اشیاء تصویر در مجموعههای تصویر چاپی، ممکن است یک ویژگی ابرداده به نام CLOUD_COVER را مشاهده کرده باشید. می توانید از آن ویژگی برای دریافت کمترین تصویر در سال 2015 در منطقه مورد علاقه خود استفاده کنید:
وقتی یک تصویر چند باندی به نقشه اضافه میشود، Earth Engine سه باند اول تصویر را انتخاب میکند و بهطور پیشفرض آنها را بهصورت قرمز، سبز و آبی نشان میدهد و مطابق با نوع داده، همانطور که قبلا توضیح داده شد ، آنها را دراز میکند. معمولاً این کار انجام نمی شود. به عنوان مثال، اگر تصویر Landsat ( scene در مثال قبلی) را به نقشه اضافه کنید، نتیجه رضایت بخش نیست:
توجه داشته باشید که ابتدا نقشه بر روی تصویر در مقیاس بزرگنمایی 9 متمرکز می شود. سپس تصویر با یک شی خالی ( {} ) برای پارامتر visParams نمایش داده می شود (برای جزئیات به اسناد Map.addLayer() مراجعه کنید). در نتیجه، تصویر با تجسم پیشفرض نمایش داده میشود: سه باند اول به ترتیب به R، G، B نگاشت میشوند و تا [0، 1] کشیده میشوند، زیرا باندها از نوع داده float هستند. این بدان معناست که نوار آئروسل ساحلی ('B1') به رنگ قرمز، نوار آبی ('B2') به رنگ سبز و نوار سبز ('B3') به رنگ آبی ارائه می شود. برای ارائه تصویر به صورت ترکیبی با رنگ واقعی، باید به Earth Engine بگویید که از باندهای Landsat 8 'B4'، 'B3' و 'B2' به ترتیب برای R، G و B استفاده کند. مشخص کنید از کدام باندها با ویژگی bands شی visParams استفاده کنید. در این مرجع با گروه های لندست بیشتر آشنا شوید.
شما همچنین باید مقادیر min و max مناسب را برای نمایش بازتاب از اهداف معمولی سطح زمین ارائه دهید. اگرچه لیست ها را می توان برای تعیین مقادیر مختلف برای هر باند استفاده کرد، در اینجا کافی است 0.3 را max و از مقدار پیش فرض صفر برای پارامتر min استفاده کنید. ترکیب پارامترهای تجسم در یک شی و نمایش:
نتیجه باید چیزی شبیه به شکل 5 باشد. توجه داشته باشید که این کد پارامترهای شیء تجسم را به یک متغیر برای استفاده احتمالی در آینده اختصاص می دهد. همانطور که به زودی متوجه خواهید شد، آن شی در هنگام تجسم مجموعه های تصویر مفید خواهد بود!
شکل 5. تصویر بازتابی Landsat 8 TOA به عنوان یک کامپوزیت با رنگ واقعی، تا [0، 0.3] کشیده شده است.
سعی کنید با تجسم باندهای مختلف بازی کنید. یکی دیگر از ترکیب های مورد علاقه "B5"، "B4" و "B3" است که به آن ترکیب رنگ کاذب می گویند. برخی دیگر از کامپوزیت های رنگ کاذب جالب در اینجا توضیح داده شده اند.
از آنجایی که Earth Engine برای انجام تجزیه و تحلیل در مقیاس بزرگ طراحی شده است، شما محدود به کار با یک صحنه نیستید. اکنون زمان نمایش یک مجموعه کامل به عنوان یک ترکیب RGB است!
نمایش مجموعه تصاویر
افزودن مجموعه تصاویر به نقشه مشابه افزودن تصویر به نقشه است. به عنوان مثال، با استفاده از تصاویر 2016 در مجموعه l8 و شیء visParams که قبلاً تعریف شده است،
توجه داشته باشید که اکنون می توانید بزرگنمایی کنید و یک موزاییک پیوسته را ببینید که در آن تصاویر Landsat جمع آوری شده است (یعنی روی زمین). همچنین توجه داشته باشید که وقتی از تب Inspector استفاده میکنید و روی تصویر کلیک میکنید، لیستی از مقادیر پیکسل (یا نمودار) را در بخش پیکسلها و فهرستی از اشیاء تصویر را در بخش Objects در بازرس مشاهده خواهید کرد.
اگر به اندازه کافی بزرگنمایی کرده باشید، احتمالاً متوجه ابرهایی در موزاییک شده اید. هنگامی که یک ImageCollection به نقشه اضافه می کنید، به عنوان یک ترکیب با مقدار اخیر نمایش داده می شود، به این معنی که فقط جدیدترین پیکسل ها نمایش داده می شوند (مانند فراخوانی mosaic() در مجموعه). به همین دلیل است که می توانید ناپیوستگی بین مسیرهایی را ببینید که در زمان های مختلف به دست آمده اند. همچنین به همین دلیل است که بسیاری از مناطق ممکن است ابری به نظر برسند. در صفحه بعد، یاد بگیرید که چگونه نحوه ترکیب تصاویر را تغییر دهید تا از شر آن ابرهای مزاحم خلاص شوید!
تاریخ آخرین بهروزرسانی 2025-07-24 بهوقت ساعت هماهنگ جهانی.
[null,null,["تاریخ آخرین بهروزرسانی 2025-07-24 بهوقت ساعت هماهنگ جهانی."],[[["\u003cp\u003eAn \u003ccode\u003eee.ImageCollection\u003c/code\u003e in Earth Engine represents a set of images, such as all Landsat 8 images, and can be filtered by location and date.\u003c/p\u003e\n"],["\u003cp\u003eIndividual images within a collection can be accessed by sorting based on metadata properties like cloud cover, allowing selection of specific images.\u003c/p\u003e\n"],["\u003cp\u003eDisplaying images requires specifying visualization parameters, like bands for RGB composites and stretching values, for optimal visualization.\u003c/p\u003e\n"],["\u003cp\u003eImage collections can be added to the map, displayed as recent-value composites, showing the most recent pixels and potential cloud cover.\u003c/p\u003e\n"],["\u003cp\u003eEarth Engine's capabilities extend beyond single scenes, enabling large-scale analyses using entire image collections and advanced compositing techniques.\u003c/p\u003e\n"]]],[],null,["# Image Collections\n\nAn image collection refers to a set of Earth Engine images. For example, the collection\nof all Landsat 8 images is an `ee.ImageCollection`. Like the SRTM image\nyou have been working with, image collections also have an ID. As with single images,\nyou can discover the ID of an image collection by searching the\n[Earth Engine data catalog](/earth-engine/datasets) from\nthe Code Editor and looking at the details page of the dataset. For example, search for\n'landsat 8 toa' and click on the first result, which should correspond to the\n[USGS Landsat 8 Collection 1 Tier 1 TOA Reflectance](https://developers.google.com/earth-engine/datasets/catalog/LANDSAT_LC08_C01_T1_TOA) dataset.\nEither import that dataset using the **Import** button and rename it to `l8`, or copy the ID into the\nimage collection constructor:\n\n### Code Editor (JavaScript)\n\n```javascript\nvar l8 = ee.ImageCollection('LANDSAT/LC08/C02/T1_TOA');\n```\n\nFiltering image collections\n---------------------------\n\nIt's worth noting that this collection represents *every* Landsat 8 scene collected,\nall over the Earth. Often it is useful to extract a single image, or subset of images,\non which to test algorithms. The way to limit the collection by time or space is by\nfiltering it. For example, to filter the collection to images that cover a particular\nlocation, first define your area of interest\nwith a point (or line or polygon) using the geometry drawing tools. Pan to your area of\ninterest, hover on the **Geometry Imports** (if you already have one or more\ngeometries defined) and click **+new layer** (if you don't have any imports,\ngo to the next step). Get the point drawing tool\n() and make a point in your area of\ninterest. Name the import `point`. Now, filter the `l8` collection\nto get *only* the images that intersect the point, then add a second filter to\nlimit the collection to only the images that were acquired in 2015:\n\n### Code Editor (JavaScript)\n\n```javascript\nvar spatialFiltered = l8.filterBounds(point);\nprint('spatialFiltered', spatialFiltered);\n\nvar temporalFiltered = spatialFiltered.filterDate('2015-01-01', '2015-12-31');\nprint('temporalFiltered', temporalFiltered);\n```\n\nHere, `filterBounds()` and `filterDate()` are shortcut methods for\nthe more general `filter()` method on image collections, which takes an\n`ee.Filter()` as its argument. Explore the **Docs** tab of the Code\nEditor to learn more about these methods. The argument to `filterBounds()`\nis the point you digitized and the arguments to `filterDate()` are two dates,\nexpressed as strings.\n\nNote that you can `print()` the filtered collections. You can't print more than\n5000 things at once, so you couldn't, for example, print the entire `l8`\ncollection. After executing the `print()` method, you can inspect the\nprinted collections in the console. Note that when you expand the\n`ImageCollection` using the zippy\n(), then expand the\nlist of `features`, you will see a list of images, each of which also can be\nexpanded and inspected. This is one way to discover the ID of an individual image. Another,\nmore programmatic way to get individual images for analysis is to sort the collection\nin order to get the most recent, oldest, or optimal image relative to some metadata\nproperty. For example, by inspecting the image objects in the printed image collections,\nyou may have observed a metadata property called `CLOUD_COVER`. You can use\nthat property to get the least cloudy image in 2015 in your area of interest:\n\n\n### Code Editor (JavaScript)\n\n```javascript\n// This will sort from least to most cloudy.\nvar sorted = temporalFiltered.sort('CLOUD_COVER');\n\n// Get the first (least cloudy) image.\nvar scene = sorted.first();\n```\n\nYou're now ready to display the image!\n\nDigression: Displaying RGB images\n---------------------------------\n\nWhen a multi-band image is added to a map, Earth Engine chooses the first three bands of\nthe image and displays them as red, green, and blue by default, stretching them according\nto the data type, [as described\npreviously](/earth-engine/tutorials/tutorial_api_02#digression-images-in-earth-engine). Usually, this won't do. For example, if you add the Landsat image\n(`scene` in the previous example) to the map, the result is unsatisfactory:\n\n### Code Editor (JavaScript)\n\n```javascript\nMap.centerObject(scene, 9);\nMap.addLayer(scene, {}, 'default RGB');\n```\n\nNote that first, the map is centered on the image at zoom scale 9. Then the image is\ndisplayed with an empty object (`{}`) for the `visParams` parameter\n(see the `Map.addLayer()` docs for details). As a result, the image is\ndisplayed with the default visualization: first three bands map to R, G, B, respectively,\nand stretched to \\[0, 1\\] since the bands are `float` data type. This means that\nthe coastal aerosol band ('B1') is rendered in red, the blue band ('B2') is rendered\nin green, and the green band ('B3') is rendered in blue. To render the image as a\ntrue-color composite, you need to tell Earth Engine to use the Landsat 8 bands 'B4', 'B3',\nand 'B2' for R, G, and B, respectively. Specify which bands to use with the\n`bands` property of the `visParams` object. Learn more about\nLandsat bands at\n[this\nreference](https://www.usgs.gov/faqs/what-are-band-designations-landsat-satellites).\n\nYou also need to provide `min` and `max` values suitable for\ndisplaying reflectance from typical Earth surface targets. Although lists can be used to\nspecify different values for each band, here it's sufficient to\nspecify `0.3` as `max` and use the default value of zero for the\n`min` parameter. Combining the visualization parameters into one object and\ndisplaying:\n\n### Code Editor (JavaScript)\n\n```javascript\nvar visParams = {bands: ['B4', 'B3', 'B2'], max: 0.3};\nMap.addLayer(scene, visParams, 'true-color composite');\n```\n\nThe result should look something like Figure 5. Note that this code assigns the object\nof visualization parameters to a variable for possible future use. As you'll soon\ndiscover, that object will be useful when you visualize image collections!\nFigure 5. Landsat 8 TOA reflectance image as a true-color composite, stretched to \\[0, 0.3\\].\n\nTry playing with visualizing different bands. Another favorite combination is 'B5', 'B4',\nand 'B3' which is called a false-color composite. Some other interesting false-color\ncomposites are described\n[here](https://www.usgs.gov/media/images/common-landsat-band-rgb-composites).\n\nSince Earth Engine is designed to do large-scale analyses, you are not limited to working\nwith just one scene. Now it's time to display a whole collection as an RGB composite!\n\nDisplaying image collections\n----------------------------\n\nAdding an image collection to a map is similar to adding an image to a map. For\nexample, using 2016 images in the `l8` collection and the `visParams`\nobject defined previously,\n\n### Code Editor (JavaScript)\n\n```javascript\nvar l8 = ee.ImageCollection('LANDSAT/LC08/C02/T1_TOA');\nvar landsat2016 = l8.filterDate('2016-01-01', '2016-12-31');\nMap.addLayer(landsat2016, visParams, 'l8 collection');\n```\n\nNote that now you can zoom out and see a continuous mosaic where Landsat imagery\nis collected (i.e. over land). Also note that when you use the **Inspector**\ntab and click on the image, you'll see a list of pixel values (or a chart) in the\n**Pixels** section and a list of image objects in the **Objects**\nsection of the inspector.\n\nIf you zoomed out enough, you probably noticed some clouds in the mosaic. When\nyou add an `ImageCollection` to the map, it is displayed as a recent-value\ncomposite, meaning that only the most recent pixels are displayed (like calling\n`mosaic()` on the collection). That is why you can see discontinuities between\n[paths](http://landsat.gsfc.nasa.gov/?p=3231) which were acquired at\ndifferent times. It's also why many areas may appear cloudy. In the next page, learn how\nto change the way the images are composited to get rid of those pesky clouds! \n[arrow_backPrevious page](/earth-engine/tutorials/tutorial_api_03) [Next pagearrow_forward](/earth-engine/tutorials/tutorial_api_05)"]]