ประกาศ: โปรเจ็กต์ที่ไม่ใช่เชิงพาณิชย์ทั้งหมดที่ลงทะเบียนเพื่อใช้ Earth Engine ก่อนวันที่
15 เมษายน 2025 ต้อง
ยืนยันการมีสิทธิ์ที่ไม่ใช่เชิงพาณิชย์เพื่อรักษาสิทธิ์เข้าถึง หากคุณไม่ยืนยันภายในวันที่ 26 กันยายน 2025 ระบบอาจระงับสิทธิ์เข้าถึงของคุณ
ee.FeatureCollection.merge
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
รวมคอลเล็กชัน 2 รายการเป็น 1 รายการ ผลลัพธ์จะมีองค์ประกอบทั้งหมดที่อยู่ในคอลเล็กชันใดคอลเล็กชันหนึ่ง
องค์ประกอบจากคอลเล็กชันแรกจะมีรหัสที่ขึ้นต้นด้วย "1" และองค์ประกอบจากคอลเล็กชันที่สองจะมีรหัสที่ขึ้นต้นด้วย "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"],[],[]]