Ankündigung: Alle nicht kommerziellen Projekte, die vor dem 15. April 2025 für die Nutzung der Earth Engine registriert wurden, müssen die Berechtigung zur nicht kommerziellen Nutzung bestätigen, um weiterhin auf die Earth Engine zugreifen zu können.
[null,null,["Zuletzt aktualisiert: 2025-07-26 (UTC)."],[[["\u003cp\u003e\u003ccode\u003eFeatureCollection.merge()\u003c/code\u003e combines two FeatureCollections into a single FeatureCollection containing all elements from both.\u003c/p\u003e\n"],["\u003cp\u003eElements from the input collections retain their original properties but are given new IDs prefixed with "1*" and "2*" to distinguish their source.\u003c/p\u003e\n"],["\u003cp\u003eFor merging multiple collections, using \u003ccode\u003eFeatureCollection.flatten()\u003c/code\u003e on a collection containing all of them is recommended for better performance.\u003c/p\u003e\n"],["\u003cp\u003eRepeatedly using \u003ccode\u003eFeatureCollection.merge()\u003c/code\u003e can lead to decreased performance and excessively long element IDs.\u003c/p\u003e\n"]]],[],null,["# ee.FeatureCollection.merge\n\nMerges two collections into one. The result has all the elements that were in either collection.\n\n\u003cbr /\u003e\n\nElements from the first collection will have IDs prefixed with \"1*\" and elements from the second collection will have IDs prefixed with \"2*\".\n| **Note:** If many collections need to be merged, consider placing them all in a collection and using FeatureCollection.flatten() instead. Repeated use of FeatureCollection.merge() will result in increasingly long element IDs and reduced performance.\n\n| Usage | Returns |\n|----------------------------------------|-------------------|\n| FeatureCollection.merge`(collection2)` | FeatureCollection |\n\n| Argument | Type | Details |\n|---------------------|-------------------|---------------------------------|\n| this: `collection1` | FeatureCollection | The first collection to merge. |\n| `collection2` | FeatureCollection | The second collection to merge. |\n\nExamples\n--------\n\n### Code Editor (JavaScript)\n\n```javascript\n// FeatureCollection of points representing forest cover.\nvar fcForest = ee.FeatureCollection([\n ee.Feature(ee.Geometry.Point([-122.248, 37.238]),\n {'id': 0, 'cover_class': 'forest'}),\n ee.Feature(ee.Geometry.Point([-122.204, 37.222]),\n {'id': 1, 'cover_class': 'forest'}),\n ee.Feature(ee.Geometry.Point([-122.110, 37.199]),\n {'id': 2, 'cover_class': 'forest'})\n]);\n\n// FeatureCollection of points representing urban cover.\nvar fcUrban = ee.FeatureCollection([\n ee.Feature(ee.Geometry.Point([-121.953, 37.372]),\n {'id': 0, 'cover_class': 'urban'}),\n ee.Feature(ee.Geometry.Point([-121.861, 37.308]),\n {'id': 1, 'cover_class': 'urban'}),\n ee.Feature(ee.Geometry.Point([-121.984, 37.372]),\n {'id': 2, 'cover_class': 'urban'})\n]);\n\n// Merge the two FeatureCollections into one.\nvar fcMerged = fcForest.merge(fcUrban);\n\n// Display FeatureCollections on the map.\nMap.setCenter(-122.034, 37.296, 11);\nMap.addLayer(fcForest, {color: 'green'}, 'Forest points');\nMap.addLayer(fcUrban, {color: 'grey'}, 'Urban points');\nMap.addLayer(fcMerged, {color: 'yellow'}, 'Protected areas merged');\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# FeatureCollection of points representing forest cover.\nfc_forest = ee.FeatureCollection([\n ee.Feature(\n ee.Geometry.Point([-122.248, 37.238]),\n {\n 'id': 0,\n 'cover_class': 'forest',\n 'id': 0,\n 'cover_class': 'forest',\n },\n ),\n ee.Feature(\n ee.Geometry.Point([-122.204, 37.222]),\n {\n 'id': 1,\n 'cover_class': 'forest',\n 'id': 1,\n 'cover_class': 'forest',\n },\n ),\n ee.Feature(\n ee.Geometry.Point([-122.110, 37.199]),\n {\n 'id': 2,\n 'cover_class': 'forest',\n 'id': 2,\n 'cover_class': 'forest',\n },\n ),\n])\n\n# FeatureCollection of points representing urban cover.\nfc_urban = ee.FeatureCollection([\n ee.Feature(\n ee.Geometry.Point([-121.953, 37.372]),\n {'id': 0, 'cover_class': 'urban', 'id': 0, 'cover_class': 'urban'},\n ),\n ee.Feature(\n ee.Geometry.Point([-121.861, 37.308]),\n {'id': 1, 'cover_class': 'urban', 'id': 1, 'cover_class': 'urban'},\n ),\n ee.Feature(\n ee.Geometry.Point([-121.984, 37.372]),\n {'id': 2, 'cover_class': 'urban', 'id': 2, 'cover_class': 'urban'},\n ),\n])\n\n# Merge the two FeatureCollections into one.\nfc_merged = fc_forest.merge(fc_urban)\n\n# Display FeatureCollections on the map.\nm = geemap.Map()\nm.set_center(-122.034, 37.296, 11)\nm.add_layer(fc_forest, {'color': 'green'}, 'Forest points')\nm.add_layer(fc_urban, {'color': 'grey'}, 'Urban points')\nm.add_layer(fc_merged, {'color': 'yellow'}, 'Protected areas merged')\nm\n```"]]