Pengumuman: Semua project nonkomersial yang terdaftar untuk menggunakan Earth Engine sebelum
15 April 2025 harus
memverifikasi kelayakan nonkomersial untuk mempertahankan akses Earth Engine.
ee.ImageCollection.merge
Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Menggabungkan dua koleksi gambar menjadi satu. Hasilnya berisi semua gambar yang ada di kedua koleksi.
Penggunaan | Hasil |
---|
ImageCollection.merge(collection2) | ImageCollection |
Argumen | Jenis | Detail |
---|
ini: collection1 | ImageCollection | Kumpulan pertama yang akan digabungkan. |
collection2 | ImageCollection | Koleksi kedua yang akan digabungkan. |
Contoh
Code Editor (JavaScript)
// Sentinel-2 surface reflectance image collection.
var ic = ee.ImageCollection('COPERNICUS/S2_SR');
// Filter the images to those that intersect Mount Shasta for 3 months
// in 2019 and 2021 (two image collections).
var geom = ee.Geometry.Point(-122.196, 41.411);
var ic2018 = ic.filterBounds(geom).filterDate('2019-07-01', '2019-10-01');
print('2018 image collection', ic2018);
var ic2021 = ic.filterBounds(geom).filterDate('2021-07-01', '2021-10-01');
print('2021 image collection', ic2021);
// Merge the two image collections.
var icMerged = ic2018.merge(ic2021);
print('Merged image collection', icMerged);
Penyiapan Python
Lihat halaman
Lingkungan Python untuk mengetahui informasi tentang Python API dan penggunaan
geemap
untuk pengembangan interaktif.
import ee
import geemap.core as geemap
Colab (Python)
# Sentinel-2 surface reflectance image collection.
ic = ee.ImageCollection('COPERNICUS/S2_SR')
# Filter the images to those that intersect Mount Shasta for 3 months
# in 2019 and 2021 (two image collections).
geom = ee.Geometry.Point(-122.196, 41.411)
ic2018 = ic.filterBounds(geom).filterDate('2019-07-01', '2019-10-01')
print('2018 image collection:', ic2018.getInfo())
ic2021 = ic.filterBounds(geom).filterDate('2021-07-01', '2021-10-01')
print('2021 image collection:', ic2021.getInfo())
# Merge the two image collections.
ic_merged = ic2018.merge(ic2021)
print('Merged image collection:', ic_merged.getInfo())
Kecuali dinyatakan lain, konten di halaman ini dilisensikan berdasarkan Lisensi Creative Commons Attribution 4.0, sedangkan contoh kode dilisensikan berdasarkan Lisensi Apache 2.0. Untuk mengetahui informasi selengkapnya, lihat Kebijakan Situs Google Developers. Java adalah merek dagang terdaftar dari Oracle dan/atau afiliasinya.
Terakhir diperbarui pada 2025-07-26 UTC.
[null,null,["Terakhir diperbarui pada 2025-07-26 UTC."],[[["\u003cp\u003e\u003ccode\u003emerge()\u003c/code\u003e combines two ImageCollections, resulting in a new collection containing all images from both inputs.\u003c/p\u003e\n"],["\u003cp\u003eThe output of \u003ccode\u003emerge()\u003c/code\u003e is a new ImageCollection with no duplicates.\u003c/p\u003e\n"],["\u003cp\u003eThis function is useful for consolidating image collections filtered by different criteria, such as date ranges or regions, as shown in the example with Sentinel-2 imagery filtered for different years.\u003c/p\u003e\n"]]],["The `merge` method combines two `ImageCollection` objects, `collection1` and `collection2`, into a single `ImageCollection`. This resulting collection contains all images from both input collections. The method takes `collection2` as an argument. An example filters a Sentinel-2 collection for 2019 and 2021, then merges these two filtered collections using `merge(ic2021)`. The output is a new collection containing images from both time periods.\n"],null,["# ee.ImageCollection.merge\n\nMerges two image collections into one. The result has all the images that were in either collection.\n\n\u003cbr /\u003e\n\n| Usage | Returns |\n|--------------------------------------|-----------------|\n| ImageCollection.merge`(collection2)` | ImageCollection |\n\n| Argument | Type | Details |\n|---------------------|-----------------|---------------------------------|\n| this: `collection1` | ImageCollection | The first collection to merge. |\n| `collection2` | ImageCollection | The second collection to merge. |\n\nExamples\n--------\n\n### Code Editor (JavaScript)\n\n```javascript\n// Sentinel-2 surface reflectance image collection.\nvar ic = ee.ImageCollection('COPERNICUS/S2_SR');\n\n// Filter the images to those that intersect Mount Shasta for 3 months\n// in 2019 and 2021 (two image collections).\nvar geom = ee.Geometry.Point(-122.196, 41.411);\nvar ic2018 = ic.filterBounds(geom).filterDate('2019-07-01', '2019-10-01');\nprint('2018 image collection', ic2018);\nvar ic2021 = ic.filterBounds(geom).filterDate('2021-07-01', '2021-10-01');\nprint('2021 image collection', ic2021);\n\n// Merge the two image collections.\nvar icMerged = ic2018.merge(ic2021);\nprint('Merged image collection', icMerged);\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# Sentinel-2 surface reflectance image collection.\nic = ee.ImageCollection('COPERNICUS/S2_SR')\n\n# Filter the images to those that intersect Mount Shasta for 3 months\n# in 2019 and 2021 (two image collections).\ngeom = ee.Geometry.Point(-122.196, 41.411)\nic2018 = ic.filterBounds(geom).filterDate('2019-07-01', '2019-10-01')\nprint('2018 image collection:', ic2018.getInfo())\nic2021 = ic.filterBounds(geom).filterDate('2021-07-01', '2021-10-01')\nprint('2021 image collection:', ic2021.getInfo())\n\n# Merge the two image collections.\nic_merged = ic2018.merge(ic2021)\nprint('Merged image collection:', ic_merged.getInfo())\n```"]]