公告 :凡是在
2025 年 4 月 15 日 前註冊使用 Earth Engine 的非商業專案,都必須
驗證非商業用途資格 ,才能繼續存取 Earth Engine。
提供意見
ee.FeatureCollection.copyProperties
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
將中繼資料屬性從一個元素複製到另一個元素。
用量 傳回 FeatureCollection. copyProperties (source , properties , exclude )
元素
引數 類型 詳細資料 這個:destination
元素,預設值:null 要覆寫屬性的物件。 source
元素,預設值:null 要從中複製屬性的物件。 properties
清單,預設值為空值 要複製的屬性。如果省略,系統會複製所有一般 (即非系統) 屬性。 exclude
清單,預設值為空值 複製所有屬性時要排除的屬性清單。如果已指定屬性,則不得指定這個欄位。
範例
程式碼編輯器 (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 環境 頁面,瞭解 Python API 和如何使用 geemap
進行互動式開發。
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 ())
提供意見
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權 ,程式碼範例則為阿帕契 2.0 授權 。詳情請參閱《Google Developers 網站政策 》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-07-26 (世界標準時間)。
想進一步說明嗎?
[[["容易理解","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 (世界標準時間)。"],[[["`copyProperties()` transfers metadata properties from a source element to a destination element in Earth Engine."],["You can copy all properties, a specified list of properties, or all properties except those in an exclusion list."],["This function is useful for maintaining metadata consistency when manipulating Earth Engine objects, such as copying image metadata to a FeatureCollection derived from it."],["The function returns the modified destination element with the copied properties."]]],[]]