Duyuru:
15 Nisan 2025'ten önce Earth Engine'i kullanmak için kaydedilen tüm ticari olmayan projelerin Earth Engine erişimini sürdürmek için
ticari olmayan uygunluğu doğrulaması gerekir.
Tüm birleştirme işlemlerini kaydetme
Koleksiyonlar ile düzeninizi koruyun
İçeriği tercihlerinize göre kaydedin ve kategorilere ayırın.
Birleştirmeleri kaydetme, Earth Engine'da bire çok ilişkileri temsil etmenin bir yoludur.
İç birleştirme'den farklı olarak, kayıt birleştirme, secondary
koleksiyonundaki eşleşmeleri primary
koleksiyonundaki özelliklerin adlandırılmış bir özelliği olarak depolar. Bu tür eşleşmelerin tümünü kaydetmek için ee.Join.saveAll()
kullanın. Bire çok ilişki varsa saveAll()
birleştirme işlemi, eşleşen tüm özellikleri ee.List
olarak depolar. primary
koleksiyonundaki eşleşmeyen öğeler atlanır. Örneğin, bir koleksiyondaki her Landsat görüntüsünden sonraki iki gün içinde elde edilen tüm MODIS görüntülerinin alınması gerektiğini varsayalım. Bu örnekte, bu amaç için bir saveAll()
birleştirme kullanılmaktadır:
Kod Düzenleyici (JavaScript)
// Load a primary collection: Landsat imagery.
var primary = ee.ImageCollection('LANDSAT/LC08/C02/T1_TOA')
.filterDate('2014-04-01', '2014-06-01')
.filterBounds(ee.Geometry.Point(-122.092, 37.42));
// Load a secondary collection: MODIS imagery.
var modSecondary = ee.ImageCollection('MODIS/006/MOD09GA')
.filterDate('2014-03-01', '2014-07-01');
// Define an allowable time difference: two days in milliseconds.
var twoDaysMillis = 2 * 24 * 60 * 60 * 1000;
// Create a time filter to define a match as overlapping timestamps.
var timeFilter = ee.Filter.or(
ee.Filter.maxDifference({
difference: twoDaysMillis,
leftField: 'system:time_start',
rightField: 'system:time_end'
}),
ee.Filter.maxDifference({
difference: twoDaysMillis,
leftField: 'system:time_end',
rightField: 'system:time_start'
})
);
// Define the join.
var saveAllJoin = ee.Join.saveAll({
matchesKey: 'terra',
ordering: 'system:time_start',
ascending: true
});
// Apply the join.
var landsatModis = saveAllJoin.apply(primary, modSecondary, timeFilter);
// Display the result.
print('Join.saveAll:', landsatModis);
Python kurulumu
Python API'si ve etkileşimli geliştirme için geemap
kullanımı hakkında bilgi edinmek üzere
Python Ortamı sayfasına bakın.
import ee
import geemap.core as geemap
Colab (Python)
# Load a primary collection: Landsat imagery.
primary = (
ee.ImageCollection('LANDSAT/LC08/C02/T1_TOA')
.filterDate('2014-04-01', '2014-06-01')
.filterBounds(ee.Geometry.Point(-122.092, 37.42))
)
# Load a secondary collection: MODIS imagery.
mod_secondary = ee.ImageCollection('MODIS/006/MOD09GA').filterDate(
'2014-03-01', '2014-07-01'
)
# Define an allowable time difference: two days in milliseconds.
two_days_millis = 2 * 24 * 60 * 60 * 1000
# Create a time filter to define a match as overlapping timestamps.
time_filter = ee.Filter.Or(
ee.Filter.maxDifference(
difference=two_days_millis,
leftField='system:time_start',
rightField='system:time_end',
),
ee.Filter.maxDifference(
difference=two_days_millis,
leftField='system:time_end',
rightField='system:time_start',
),
)
# Define the join.
save_all_join = ee.Join.saveAll(
matchesKey='terra', ordering='system:time_start', ascending=True
)
# Apply the join.
landsat_modis = save_all_join.apply(primary, mod_secondary, time_filter)
# Display the result.
display('Join.saveAll:', landsat_modis)
Bu örnekte, secondary
MODIS koleksiyonunun verimlilik için primary
Landsat koleksiyonuna zamansal olarak benzer olacak şekilde önceden filtrelendiğini unutmayın. Filtre, Landsat edinme zamanını günlük aralığı olan MODIS birleşik zamanıyla karşılaştırmak için resim zaman damgalarının uç noktalarını karşılaştırır. Birleştirme, her Landsat görüntüsünün eşleşme listesini depolamak için kullanılan mülkün adıyla (‘terra’
) ve eşleşme listesini system:time_start
mülküne göre sıralamak için isteğe bağlı parametreyle tanımlanır.
Sonuç incelendiğinde, birincil koleksiyondaki resimlerde eşleşen MODIS resimlerinin listesini depolayan terra
mülkünün eklenmiş olduğu görülüyor.
Aksi belirtilmediği sürece bu sayfanın içeriği Creative Commons Atıf 4.0 Lisansı altında ve kod örnekleri Apache 2.0 Lisansı altında lisanslanmıştır. Ayrıntılı bilgi için Google Developers Site Politikaları'na göz atın. Java, Oracle ve/veya satış ortaklarının tescilli ticari markasıdır.
Son güncelleme tarihi: 2025-07-25 UTC.
[null,null,["Son güncelleme tarihi: 2025-07-25 UTC."],[[["\u003cp\u003eSaving joins represent one-to-many relationships in Earth Engine by storing matches from a secondary collection as a property in the primary collection.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eee.Join.saveAll()\u003c/code\u003e stores all matching features from the secondary collection as a list in a new property of the primary collection's features, dropping unmatched primary features.\u003c/p\u003e\n"],["\u003cp\u003eThis approach is useful for scenarios like associating all MODIS images within a specific time window to each Landsat image in a collection.\u003c/p\u003e\n"],["\u003cp\u003eThe example code demonstrates filtering and joining Landsat and MODIS collections based on their timestamps, storing the matching MODIS images in a 'terra' property on each Landsat image.\u003c/p\u003e\n"]]],["Saving joins represent one-to-many relationships by storing matches from a secondary collection as a property within the primary collection's features. `ee.Join.saveAll()` stores all matching features as an `ee.List`. The example filters Landsat and MODIS imagery collections, defining a two-day time difference as the matching condition using a time filter. A `saveAll()` join, named `'terra'`, is applied, sorting matches by `system:time_start`. The result has the added property `terra` with a list of matching MODIS images. Unmatched primary collection elements are dropped.\n"],null,["# Save-All Joins\n\nSaving joins are one way of representing one-to-many relationships in Earth Engine.\nUnlike an [inner join](/earth-engine/guides/joins_inner), a saving join stores matches from the\n`secondary` collection as a named property of the features in the\n`primary` collection. To save all such matches, use an\n`ee.Join.saveAll()`. If there is a one-to-many relationship, a\n`saveAll()` join stores all matching features as an\n`ee.List`. Unmatched elements in the `primary` collection are\ndropped. For example, suppose there is a need to get all MODIS imagery acquired\nwithin two days of each Landsat image in a collection. This example uses a\n`saveAll()` join for that purpose:\n\n### Code Editor (JavaScript)\n\n```javascript\n// Load a primary collection: Landsat imagery.\nvar primary = ee.ImageCollection('LANDSAT/LC08/C02/T1_TOA')\n .filterDate('2014-04-01', '2014-06-01')\n .filterBounds(ee.Geometry.Point(-122.092, 37.42));\n\n// Load a secondary collection: MODIS imagery.\nvar modSecondary = ee.ImageCollection('MODIS/006/MOD09GA')\n .filterDate('2014-03-01', '2014-07-01');\n\n// Define an allowable time difference: two days in milliseconds.\nvar twoDaysMillis = 2 * 24 * 60 * 60 * 1000;\n\n// Create a time filter to define a match as overlapping timestamps.\nvar timeFilter = ee.Filter.or(\n ee.Filter.maxDifference({\n difference: twoDaysMillis,\n leftField: 'system:time_start',\n rightField: 'system:time_end'\n }),\n ee.Filter.maxDifference({\n difference: twoDaysMillis,\n leftField: 'system:time_end',\n rightField: 'system:time_start'\n })\n);\n\n// Define the join.\nvar saveAllJoin = ee.Join.saveAll({\n matchesKey: 'terra',\n ordering: 'system:time_start',\n ascending: true\n});\n\n// Apply the join.\nvar landsatModis = saveAllJoin.apply(primary, modSecondary, timeFilter);\n\n// Display the result.\nprint('Join.saveAll:', landsatModis);\n```\nPython setup\n\nSee the [Python Environment](/earth-engine/guides/python_install) page for information on the Python API and using\n`geemap` for interactive development. \n\n```python\nimport ee\nimport geemap.core as geemap\n```\n\n### Colab (Python)\n\n```python\n# Load a primary collection: Landsat imagery.\nprimary = (\n ee.ImageCollection('LANDSAT/LC08/C02/T1_TOA')\n .filterDate('2014-04-01', '2014-06-01')\n .filterBounds(ee.Geometry.Point(-122.092, 37.42))\n)\n\n# Load a secondary collection: MODIS imagery.\nmod_secondary = ee.ImageCollection('MODIS/006/MOD09GA').filterDate(\n '2014-03-01', '2014-07-01'\n)\n\n# Define an allowable time difference: two days in milliseconds.\ntwo_days_millis = 2 * 24 * 60 * 60 * 1000\n\n# Create a time filter to define a match as overlapping timestamps.\ntime_filter = ee.Filter.Or(\n ee.Filter.maxDifference(\n difference=two_days_millis,\n leftField='system:time_start',\n rightField='system:time_end',\n ),\n ee.Filter.maxDifference(\n difference=two_days_millis,\n leftField='system:time_end',\n rightField='system:time_start',\n ),\n)\n\n# Define the join.\nsave_all_join = ee.Join.saveAll(\n matchesKey='terra', ordering='system:time_start', ascending=True\n)\n\n# Apply the join.\nlandsat_modis = save_all_join.apply(primary, mod_secondary, time_filter)\n\n# Display the result.\ndisplay('Join.saveAll:', landsat_modis)\n```\n\nIn this example, note that the `secondary` MODIS collection is pre-filtered to be\nchronologically similar to the `primary` Landsat collection for efficiency. To\ncompare the Landsat acquisition time to the MODIS composite time, which has a daily range,\nthe filter compares the endpoints of the image timestamps. The join is defined with the\nname of the property used to store the list of matches for each Landsat image\n(`'terra'`) and optional parameter to sort the list of matches by the\n`system:time_start` property\n\nInspection of the result indicates that images within the primary collection have the\nadded `terra` property which stores a list of the matching MODIS images."]]