ประกาศ: โปรเจ็กต์ที่ไม่ใช่เชิงพาณิชย์ทั้งหมดที่ลงทะเบียนเพื่อใช้ Earth Engine ก่อนวันที่
15 เมษายน 2025 ต้อง
ยืนยันการมีสิทธิ์ที่ไม่ใช่เชิงพาณิชย์เพื่อรักษาสิทธิ์เข้าถึง หากคุณไม่ยืนยันภายในวันที่ 26 กันยายน 2025 ระบบอาจระงับสิทธิ์เข้าถึงของคุณ
ee.FeatureCollection.copyProperties
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
คัดลอกพร็อพเพอร์ตี้ข้อมูลเมตาจากองค์ประกอบหนึ่งไปยังอีกองค์ประกอบหนึ่ง
| การใช้งาน | การคืนสินค้า |
|---|
FeatureCollection.copyProperties(source, properties, exclude) | องค์ประกอบ |
| อาร์กิวเมนต์ | ประเภท | รายละเอียด |
|---|
ดังนี้ destination | องค์ประกอบ ค่าเริ่มต้น: null | ออบเจ็กต์ที่จะลบล้างพร็อพเพอร์ตี้ |
source | องค์ประกอบ ค่าเริ่มต้น: null | ออบเจ็กต์ที่จะคัดลอกพร็อพเพอร์ตี้ |
properties | รายการ (ค่าเริ่มต้น: null) | พร็อพเพอร์ตี้ที่จะคัดลอก หากไม่ระบุ ระบบจะคัดลอกพร็อพเพอร์ตี้ทั่วไปทั้งหมด (เช่น พร็อพเพอร์ตี้ที่ไม่ใช่ของระบบ) |
exclude | รายการ (ค่าเริ่มต้น: null) | รายการพร็อพเพอร์ตี้ที่จะยกเว้นเมื่อคัดลอกพร็อพเพอร์ตี้ทั้งหมด ต้องไม่ระบุหากมีการระบุพร็อพเพอร์ตี้ |
ตัวอย่าง
โปรแกรมแก้ไขโค้ด (JavaScript)
// Import a Landsat 8 surface reflectance image to sample.
var image = ee.Image('LANDSAT/LC08/C02/T1_L2/LC08_038032_20170722')
// Select the optical bands.
.select(['SR_B.']);
// Get the image geometry to define the geographical bounds of the sample.
var imageBounds = image.geometry();
// Sample the image at a set of random points; a feature collection is returned.
var pointSampleFc = image.sample(
{region: imageBounds, scale: 30, numPixels: 5, geometries: true});
// Copy image properties to the FeatureCollection; three options follow.
print('All non-system image properties copied to the FeatureCollection',
pointSampleFc.copyProperties(image));
print('Selected image properties copied to the FeatureCollection',
pointSampleFc.copyProperties({
source: image,
properties: ['system:time_start', 'SPACECRAFT_ID']
}));
print('All but selected image properties copied to the FeatureCollection',
pointSampleFc.copyProperties({
source: image,
exclude: ['TIRS_SSM_MODEL', 'TIRS_SSM_POSITION_STATUS']
}));
การตั้งค่า Python
ดูข้อมูลเกี่ยวกับ Python API และการใช้ geemap เพื่อการพัฒนาแบบอินเทอร์แอกทีฟได้ที่หน้า
สภาพแวดล้อม Python
import ee
import geemap.core as geemap
Colab (Python)
# Import a Landsat 8 surface reflectance image to sample.
image = ee.Image('LANDSAT/LC08/C02/T1_L2/LC08_038032_20170722').select(
# Select the optical bands.
['SR_B.'])
# Get the image geometry to define the geographical bounds of the sample.
image_bounds = image.geometry()
# Sample the image at a set of random points; a feature collection is returned.
point_sample_fc = image.sample(
**{'region': image_bounds, 'scale': 30, 'numPixels': 5, 'geometries': True})
# Copy image properties to the FeatureCollection; three options follow.
print('All non-system image properties copied to the FeatureCollection:',
point_sample_fc.copyProperties(image).getInfo())
print('Selected image properties copied to the FeatureCollection:',
point_sample_fc.copyProperties(**{
'source': image,
'properties': ['system:time_start', 'SPACECRAFT_ID']
}).getInfo())
print('All but selected image properties copied to the FeatureCollection:',
point_sample_fc.copyProperties(**{
'source': image,
'exclude': ['TIRS_SSM_MODEL', 'TIRS_SSM_POSITION_STATUS']
}).getInfo())
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-26 UTC
[null,null,["อัปเดตล่าสุด 2025-07-26 UTC"],[],[]]