Announcement: All noncommercial projects registered to use Earth Engine before April 15, 2025 must verify noncommercial eligibility to maintain Earth Engine access.
Stay organized with collections
Save and categorize content based on your preferences.
To save only the first match for each element in a collection, use an
ee.Join.saveFirst(). The saveFirst() join functions in an
equivalent way to the saveAll() join, except for each element in the
primary collection, it simply saves the first element from the
secondary collection matching the condition specified in the
ee.Filter. Unmatched elements in the primary collection
are dropped. Unless a sorting property and an order are supplied (as in the
saveAll example), the first element saved might be
any of the elements in the list found by saveAll() with the same filter.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2021-05-26 UTC."],[[["\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."]]