ee.ImageCollection.iterate
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
ใช้ฟังก์ชันที่ผู้ใช้ระบุกับแต่ละองค์ประกอบของคอลเล็กชัน ฟังก์ชันที่ผู้ใช้ระบุจะได้รับอาร์กิวเมนต์ 2 รายการ ได้แก่ องค์ประกอบปัจจุบัน และค่าที่การเรียกใช้ iterate() ครั้งก่อนหน้าส่งคืน หรืออาร์กิวเมนต์แรกสำหรับการวนซ้ำครั้งแรก ผลลัพธ์คือค่าที่ฟังก์ชันที่ผู้ใช้ระบุส่งคืนจากการเรียกครั้งสุดท้าย
แสดงผลลัพธ์ของการเรียก Collection.iterate()
การใช้งาน | การคืนสินค้า |
---|
ImageCollection.iterate(algorithm, first) | ComputedObject |
อาร์กิวเมนต์ | ประเภท | รายละเอียด |
---|
ดังนี้ collection | คอลเล็กชัน | อินสแตนซ์คอลเล็กชัน |
algorithm | ฟังก์ชัน | ฟังก์ชันที่จะใช้กับแต่ละองค์ประกอบ ต้องรับอาร์กิวเมนต์ 2 รายการ ได้แก่ องค์ประกอบของคอลเล็กชันและค่าจากการวนซ้ำก่อนหน้า |
first | ออบเจ็กต์ (ไม่บังคับ) | สถานะเริ่มต้น |
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-26 UTC
[null,null,["อัปเดตล่าสุด 2025-07-26 UTC"],[[["\u003cp\u003eApplies a custom function iteratively to each element of a collection, using the previous result in each subsequent calculation.\u003c/p\u003e\n"],["\u003cp\u003eReturns the final computed value after applying the function across all elements.\u003c/p\u003e\n"],["\u003cp\u003eBegins with an initial state (optional) and updates it based on the user-provided function and each element in the collection.\u003c/p\u003e\n"],["\u003cp\u003eUseful for implementing custom algorithms or calculations across collections like ImageCollections.\u003c/p\u003e\n"]]],["`iterate()` applies a user-defined function to each collection element. This function receives the current element and the prior iteration's result as arguments. The process starts with an optional initial state (`first`). The final output is the value produced by the user-defined function's last execution. It's used on a `Collection` with the `algorithm` being a function and `first` as optional. It returns a `ComputedObject`.\n"],null,["# ee.ImageCollection.iterate\n\n\u003cbr /\u003e\n\nApplies a user-supplied function to each element of a collection. The user-supplied function is given two arguments: the current element, and the value returned by the previous call to iterate() or the first argument, for the first iteration. The result is the value returned by the final call to the user-supplied function.\n\n\u003cbr /\u003e\n\nReturns the result of the Collection.iterate() call.\n\n| Usage | Returns |\n|-------------------------------------------------|----------------|\n| ImageCollection.iterate`(algorithm, `*first*`)` | ComputedObject |\n\n| Argument | Type | Details |\n|--------------------|------------------|-----------------------------------------------------------------------------------------------------------------------------------------|\n| this: `collection` | Collection | The Collection instance. |\n| `algorithm` | Function | The function to apply to each element. Must take two arguments: an element of the collection and the value from the previous iteration. |\n| `first` | Object, optional | The initial state. |"]]