Ogłoszenie: wszystkie projekty niekomercyjne zarejestrowane do korzystania z Earth Engine przed
15 kwietnia 2025 r. muszą
potwierdzić spełnianie warunków użycia niekomercyjnego, aby zachować dostęp. Jeśli nie przejdziesz weryfikacji do 26 września 2025 r., Twój dostęp może zostać wstrzymany.
ee.FeatureCollection.copyProperties
Zadbaj o dobrą organizację dzięki kolekcji
Zapisuj i kategoryzuj treści zgodnie ze swoimi preferencjami.
Kopiuje właściwości metadanych z jednego elementu do drugiego.
| Wykorzystanie | Zwroty |
|---|
FeatureCollection.copyProperties(source, properties, exclude) | Element |
| Argument | Typ | Szczegóły |
|---|
to: destination | Element, domyślnie: null | Obiekt, którego właściwości mają zostać zastąpione. |
source | Element, domyślnie: null | Obiekt, z którego mają zostać skopiowane właściwości. |
properties | Lista, domyślna: null | Właściwości do skopiowania. Jeśli ten parametr zostanie pominięty, zostaną skopiowane wszystkie zwykłe (czyli niesystemowe) właściwości. |
exclude | Lista, domyślna: null | Lista usług do wykluczenia podczas kopiowania wszystkich usług. Nie może być określony, jeśli określono właściwości. |
Przykłady
Edytor kodu (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']
}));
Konfiguracja Pythona
Informacje o interfejsie Python API i używaniu geemap do interaktywnego programowania znajdziesz na stronie
Środowisko 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.
display('All non-system image properties copied to the FeatureCollection:',
point_sample_fc.copyProperties(image))
display('Selected image properties copied to the FeatureCollection:',
point_sample_fc.copyProperties(**{
'source': image,
'properties': ['system:time_start', 'SPACECRAFT_ID']
}))
display('All but selected image properties copied to the FeatureCollection:',
point_sample_fc.copyProperties(**{
'source': image,
'exclude': ['TIRS_SSM_MODEL', 'TIRS_SSM_POSITION_STATUS']
}))
O ile nie stwierdzono inaczej, treść tej strony jest objęta licencją Creative Commons – uznanie autorstwa 4.0, a fragmenty kodu są dostępne na licencji Apache 2.0. Szczegółowe informacje na ten temat zawierają zasady dotyczące witryny Google Developers. Java jest zastrzeżonym znakiem towarowym firmy Oracle i jej podmiotów stowarzyszonych.
Ostatnia aktualizacja: 2025-10-30 UTC.
[null,null,["Ostatnia aktualizacja: 2025-10-30 UTC."],[],[]]