如要只儲存集合中每個元素的第一個相符項目,請使用 ee.Join.saveFirst()
。saveFirst()
彙整函式與 saveAll()
彙整函式的作用方式相同,只是 primary
集合中的每個元素,只會儲存符合 ee.Filter
中指定條件的 secondary
集合中的第一個元素。primary
集合中不相符的元素會遭到捨棄。除非提供排序屬性和順序 (如saveAll 範例所示),否則儲存的第一個元素可能是 saveAll()
使用相同篩選器所找到的清單中任何元素。
儲存先彙整
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-07-25 (世界標準時間)。
[null,null,["上次更新時間:2025-07-25 (世界標準時間)。"],[[["\u003cp\u003e\u003ccode\u003eee.Join.saveFirst()\u003c/code\u003e is used to save only the first matching element from a secondary collection to each element in a primary collection.\u003c/p\u003e\n"],["\u003cp\u003eIt functions similarly to \u003ccode\u003eee.Join.saveAll()\u003c/code\u003e, but only retains the first match, potentially dropping unmatched primary elements.\u003c/p\u003e\n"],["\u003cp\u003eThe "first" match is arbitrary unless a specific sorting property and order are defined within the join.\u003c/p\u003e\n"]]],[],null,["# Save-First Joins\n\nTo save only the first match for each element in a collection, use an\n`ee.Join.saveFirst()`. The `saveFirst()` join functions in an\nequivalent way to the `saveAll()` join, except for each element in the\n`primary` collection, it simply saves the first element from the\n`secondary` collection matching the condition specified in the\n`ee.Filter`. Unmatched elements in the `primary` collection\nare dropped. Unless a sorting property and an order are supplied (as in the\n[saveAll example](/earth-engine/guides/joins_save_all)), the first element saved might be\nany of the elements in the list found by `saveAll()` with the same filter."]]