如要使用資料集資料導向樣式,需要有地圖 ID。如果地圖 ID 缺少或傳遞無效的地圖 ID,就無法載入資料集資料導向樣式。您可以使用 MapCapabilities 進行疑難排解,確認資料集是否支援資料導向樣式。
Kotlin
valcapabilities:MapCapabilities=googleMap.getMapCapabilities()System.out.println("Data-driven Styling is available: "+capabilities.isDataDrivenStylingAvailable())
Java
MapCapabilitiescapabilities=googleMap.getMapCapabilities();System.out.println("Data-driven Styling is available: "+capabilities.isDataDrivenStylingAvailable());
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["缺少我需要的資訊","missingTheInformationINeed","thumb-down"],["過於複雜/步驟過多","tooComplicatedTooManySteps","thumb-down"],["過時","outOfDate","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["示例/程式碼問題","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-01-14 (世界標準時間)。"],[[["To utilize data-driven styling for datasets, you'll need a Cloud project with billing enabled, the Maps SDK for Android, and the Maps Datasets API enabled."],["Ensure your app uses the upgraded map renderer (available since version 18.0.0 of the Maps SDK for Android) to support data-driven styling, rebuilding the app if necessary."],["You'll need to create a map ID associated with a new map style, then update your map initialization code to include this map ID."],["Before applying data-driven styling, it's crucial to check for map capabilities at runtime using `MapCapabilities` and provide fallback options for unsupported devices."],["Data-driven styling requires a valid map ID; if missing or invalid, the styling will fail to load."]]],[]]