公告:凡是在
2025 年 4 月 15 日前註冊使用 Earth Engine 的非商業專案,都必須
驗證非商業用途資格,才能繼續存取 Earth Engine。
ui.util.getCurrentPosition
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
從瀏覽器的地理位置服務取得使用者目前的地理位置。
用量 | 傳回 |
---|
ui.util.getCurrentPosition(success, error) | |
引數 | 類型 | 詳細資料 |
---|
success | 函式 | 回呼函式,會將 ee.Geometry.Point 物件做為輸入參數。 |
error | 函式 (選用) | 選用回呼函式,會將錯誤訊息做為輸入參數。 |
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-07-26 (世界標準時間)。
[null,null,["上次更新時間:2025-07-26 (世界標準時間)。"],[[["\u003cp\u003e\u003ccode\u003eui.util.getCurrentPosition\u003c/code\u003e retrieves the user's current location using the browser's geolocation service.\u003c/p\u003e\n"],["\u003cp\u003eThe function accepts two arguments: a mandatory \u003ccode\u003esuccess\u003c/code\u003e callback function for handling the location data (as an \u003ccode\u003eee.Geometry.Point\u003c/code\u003e) and an optional \u003ccode\u003eerror\u003c/code\u003e callback for handling potential errors.\u003c/p\u003e\n"]]],["This functionality retrieves the user's current location using the browser's geolocation. It utilizes `ui.util.getCurrentPosition(success, error)`. The `success` argument, a function, receives a `ee.Geometry.Point` object representing the location. An optional `error` argument, also a function, handles potential errors, receiving an error message as input. The function doesn't explicitly return any value but rather communicates the location or an error via callback functions.\n"],null,["# ui.util.getCurrentPosition\n\n\u003cbr /\u003e\n\nGets the user's current geographic position from the browser's geolocation service.\n\n\u003cbr /\u003e\n\n| Usage | Returns |\n|--------------------------------------------------|---------|\n| `ui.util.getCurrentPosition(success, `*error*`)` | |\n\n| Argument | Type | Details |\n|-----------|--------------------|-----------------------------------------------------------------------------------|\n| `success` | Function | A callback function that takes a ee.Geometry.Point object as its input parameter. |\n| `error` | Function, optional | An optional callback function that takes an error message as its input parameter. |"]]