お知らせ:
2025 年 4 月 15 日より前に Earth Engine の使用を登録したすべての非商用プロジェクトは、アクセスを維持するために
非商用目的での利用資格を確認する必要があります。2025 年 9 月 26 日までに確認が完了していない場合、アクセスが保留されることがあります。
ee.FeatureCollection.merge
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
2 つのコレクションを 1 つに統合します。結果には、いずれかのコレクションに含まれていたすべての要素が含まれます。
最初のコレクションの要素の ID には「1」という接頭辞が付き、2 番目のコレクションの要素の ID には「2」という接頭辞が付きます。
用途 | 戻り値 |
---|
FeatureCollection.merge(collection2) | FeatureCollection |
引数 | タイプ | 詳細 |
---|
これ: collection1 | FeatureCollection | 統合する最初のコレクション。 |
collection2 | FeatureCollection | 統合する 2 つ目のコレクション。 |
例
コードエディタ(JavaScript)
// FeatureCollection of points representing forest cover.
var fcForest = ee.FeatureCollection([
ee.Feature(ee.Geometry.Point([-122.248, 37.238]),
{'id': 0, 'cover_class': 'forest'}),
ee.Feature(ee.Geometry.Point([-122.204, 37.222]),
{'id': 1, 'cover_class': 'forest'}),
ee.Feature(ee.Geometry.Point([-122.110, 37.199]),
{'id': 2, 'cover_class': 'forest'})
]);
// FeatureCollection of points representing urban cover.
var fcUrban = ee.FeatureCollection([
ee.Feature(ee.Geometry.Point([-121.953, 37.372]),
{'id': 0, 'cover_class': 'urban'}),
ee.Feature(ee.Geometry.Point([-121.861, 37.308]),
{'id': 1, 'cover_class': 'urban'}),
ee.Feature(ee.Geometry.Point([-121.984, 37.372]),
{'id': 2, 'cover_class': 'urban'})
]);
// Merge the two FeatureCollections into one.
var fcMerged = fcForest.merge(fcUrban);
// Display FeatureCollections on the map.
Map.setCenter(-122.034, 37.296, 11);
Map.addLayer(fcForest, {color: 'green'}, 'Forest points');
Map.addLayer(fcUrban, {color: 'grey'}, 'Urban points');
Map.addLayer(fcMerged, {color: 'yellow'}, 'Protected areas merged');
Python の設定
Python API とインタラクティブな開発での geemap
の使用については、
Python 環境のページをご覧ください。
import ee
import geemap.core as geemap
Colab(Python)
# FeatureCollection of points representing forest cover.
fc_forest = ee.FeatureCollection([
ee.Feature(
ee.Geometry.Point([-122.248, 37.238]),
{
'id': 0,
'cover_class': 'forest',
'id': 0,
'cover_class': 'forest',
},
),
ee.Feature(
ee.Geometry.Point([-122.204, 37.222]),
{
'id': 1,
'cover_class': 'forest',
'id': 1,
'cover_class': 'forest',
},
),
ee.Feature(
ee.Geometry.Point([-122.110, 37.199]),
{
'id': 2,
'cover_class': 'forest',
'id': 2,
'cover_class': 'forest',
},
),
])
# FeatureCollection of points representing urban cover.
fc_urban = ee.FeatureCollection([
ee.Feature(
ee.Geometry.Point([-121.953, 37.372]),
{'id': 0, 'cover_class': 'urban', 'id': 0, 'cover_class': 'urban'},
),
ee.Feature(
ee.Geometry.Point([-121.861, 37.308]),
{'id': 1, 'cover_class': 'urban', 'id': 1, 'cover_class': 'urban'},
),
ee.Feature(
ee.Geometry.Point([-121.984, 37.372]),
{'id': 2, 'cover_class': 'urban', 'id': 2, 'cover_class': 'urban'},
),
])
# Merge the two FeatureCollections into one.
fc_merged = fc_forest.merge(fc_urban)
# Display FeatureCollections on the map.
m = geemap.Map()
m.set_center(-122.034, 37.296, 11)
m.add_layer(fc_forest, {'color': 'green'}, 'Forest points')
m.add_layer(fc_urban, {'color': 'grey'}, 'Urban points')
m.add_layer(fc_merged, {'color': 'yellow'}, 'Protected areas merged')
m
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2025-07-26 UTC。
[[["わかりやすい","easyToUnderstand","thumb-up"],["問題の解決に役立った","solvedMyProblem","thumb-up"],["その他","otherUp","thumb-up"]],[["必要な情報がない","missingTheInformationINeed","thumb-down"],["複雑すぎる / 手順が多すぎる","tooComplicatedTooManySteps","thumb-down"],["最新ではない","outOfDate","thumb-down"],["翻訳に関する問題","translationIssue","thumb-down"],["サンプル / コードに問題がある","samplesCodeIssue","thumb-down"],["その他","otherDown","thumb-down"]],["最終更新日 2025-07-26 UTC。"],[],[]]