公告:凡是在
2025 年 4 月 15 日前註冊使用 Earth Engine 的非商業專案,都必須
驗證非商業用途資格,才能繼續存取 Earth Engine。
Map.setControlVisibility
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
設定地圖上控制項的顯示設定。
傳回這個 ui.Map。
用量 | 傳回 |
---|
Map.setControlVisibility(all, layerList, zoomControl, scaleControl, mapTypeControl, fullscreenControl, drawingToolsControl) | ui.Map |
引數 | 類型 | 詳細資料 |
---|
all | 布林值 (選填) | 是否顯示所有控制選項。如果設為 False,系統會隱藏所有控制項;如果設為 True,系統會顯示所有控制項。由個別設定的參數覆寫。請注意,明確設定這項屬性會影響日後新增的任何其他控制項。 |
layerList | 布林值 (選填) | 如果設為 false,系統會隱藏圖層清單面板;如果設為 true,系統會根據清單中是否有圖層,決定是否顯示圖層清單面板。預設為顯示清單。 |
zoomControl | 布林值 (選填) | 縮放控制項是否顯示在畫面上。預設為 true。 |
scaleControl | 布林值 (選填) | 是否顯示控制項,指出地圖目前縮放等級的比例。預設為 true。 |
mapTypeControl | 布林值 (選填) | 是否顯示可讓使用者變更基本地圖的控制項。預設為 true。 |
fullscreenControl | 布林值 (選填) | 是否顯示可讓使用者將地圖設為全螢幕的控制項。預設為 true。 |
drawingToolsControl | 布林值 (選填) | 是否顯示可供使用者新增或編輯幾何圖形繪圖工具的控制項。預設為 true。 |
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-07-26 (世界標準時間)。
[null,null,["上次更新時間:2025-07-26 (世界標準時間)。"],[[["\u003cp\u003e\u003ccode\u003eMap.setControlVisibility()\u003c/code\u003e allows customization of the visibility of map controls, such as zoom, scale, layer list, map type, fullscreen, and drawing tools.\u003c/p\u003e\n"],["\u003cp\u003eControl visibility can be set individually for each control or globally using the \u003ccode\u003eall\u003c/code\u003e parameter, with individual settings overriding the global setting.\u003c/p\u003e\n"],["\u003cp\u003eBy default, all map controls are visible; setting \u003ccode\u003eall\u003c/code\u003e to \u003ccode\u003efalse\u003c/code\u003e will hide all controls, while setting it to \u003ccode\u003etrue\u003c/code\u003e will show all.\u003c/p\u003e\n"],["\u003cp\u003eThe layer list's visibility is influenced by the presence of layers and can be further customized using the \u003ccode\u003elayerList\u003c/code\u003e parameter.\u003c/p\u003e\n"]]],["The `Map.setControlVisibility` function sets the visibility of map controls. It accepts boolean arguments: `all`, `layerList`, `zoomControl`, `scaleControl`, `mapTypeControl`, `fullscreenControl`, and `drawingToolsControl`. `all` toggles all controls, while the others manage individual controls. Defaults for all controls except the layer list are set to show, the default for the layer list is to show if layers are present. The function returns the `ui.Map` object.\n"],null,["# Map.setControlVisibility\n\n\u003cbr /\u003e\n\nSets the visibility of the controls on the map.\n\n\u003cbr /\u003e\n\nReturns this ui.Map.\n\n| Usage | Returns |\n|-----------------------------------------------------------------------------------------------------------------------------------------------------------------|---------|\n| `Map.setControlVisibility(`*all* `, `*layerList* `, `*zoomControl* `, `*scaleControl* `, `*mapTypeControl* `, `*fullscreenControl* `, `*drawingToolsControl*`)` | ui.Map |\n\n| Argument | Type | Details |\n|-----------------------|-------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `all` | Boolean, optional | Whether to show all controls. False hides all controls; true shows all controls. Overridden by individually set parameters. Note that setting this explicitly will affect any additional controls added in the future. |\n| `layerList` | Boolean, optional | When false, hides the layer list panel or, when true, allows the layer list panel's visibility to be determined by the presence of layers in the list. The default is to show the list. |\n| `zoomControl` | Boolean, optional | Whether the zoom control is visible. Defaults to true. |\n| `scaleControl` | Boolean, optional | Whether to show the control which indicates the scale at the map's current zoom level. Defaults to true. |\n| `mapTypeControl` | Boolean, optional | Whether to show the control that allows the user to change the base map. Defaults to true. |\n| `fullscreenControl` | Boolean, optional | Whether to show the control that allows the user to make the map full-screen. Defaults to true. |\n| `drawingToolsControl` | Boolean, optional | Whether to show the control that allows the user to add or edit the geometry drawing tools. Defaults to true. |"]]