اتّبِع الخطوات التالية لإعداد ميزة "تنسيق مستند إلى البيانات" لمجموعات البيانات.
الحصول على مفتاح واجهة برمجة التطبيقات وتفعيل واجهات برمجة التطبيقات
قبل استخدام ميزة "تحديد الأنماط المستند إلى البيانات" لمجموعات البيانات، يجب استيفاء ما يلي:
مشروع على السحابة الإلكترونية يتضمّن حسابًا للفوترة، مع تفعيل كلّ من
Maps SDK for Android وMaps Datasets API. لمزيد من المعلومات، يُرجى الاطّلاع على:
يتوفّر برنامج عرض خرائط مُحسَّن اعتبارًا من الإصدار 18.0.0 من حزمة تطوير البرامج بالاستناد إلى بيانات "خرائط Google" لتطبيقات Android. يوفّر أداة العرض هذه العديد من التحسينات، بما في ذلك إمكانية تصميم الخرائط باستخدام السحابة الإلكترونية، في "حزمة تطوير البرامج بالاستناد إلى بيانات خرائط Google" لنظام التشغيل Android.
مع طرح الإصدار 18.2.0 من "حزمة تطوير البرامج بالاستناد إلى بيانات خرائط Google للتطبيقات المتوافقة مع Android"، بدّلت Google عارض الخريطة التلقائي من عارض الخريطة القديم إلى عارض الخريطة المحسّن. يعني هذا التغيير أنّه يتم الآن استخدام أداة عرض الخرائط المطوّرة تلقائيًا في تطبيقك عند إنشاء تطبيق جديد أو إعادة إنشاء تطبيق حالي.
إنشاء رقم تعريف خريطة
لإنشاء معرّف خريطة جديد، اتّبِع الخطوات الواردة في مقالة إنشاء معرّف خريطة. احرص على ضبط نوع الخريطة على Android.
يتطلّب التصميم المستند إلى البيانات لمجموعات البيانات معرّف خريطة. في حال عدم توفّر رقم تعريف الخريطة أو تمرير رقم تعريف خريطة غير صالح، لا يمكن تحميل الأنماط المستندة إلى البيانات لمجموعات البيانات. كخطوة لتحديد المشاكل وحلّها، يمكنك استخدام
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());
تاريخ التعديل الأخير: 2025-08-31 (حسب التوقيت العالمي المتفَّق عليه)
[null,null,["تاريخ التعديل الأخير: 2025-08-31 (حسب التوقيت العالمي المتفَّق عليه)"],[[["\u003cp\u003eTo 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.\u003c/p\u003e\n"],["\u003cp\u003eEnsure 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.\u003c/p\u003e\n"],["\u003cp\u003eYou'll need to create a map ID associated with a new map style, then update your map initialization code to include this map ID.\u003c/p\u003e\n"],["\u003cp\u003eBefore applying data-driven styling, it's crucial to check for map capabilities at runtime using \u003ccode\u003eMapCapabilities\u003c/code\u003e and provide fallback options for unsupported devices.\u003c/p\u003e\n"],["\u003cp\u003eData-driven styling requires a valid map ID; if missing or invalid, the styling will fail to load.\u003c/p\u003e\n"]]],[],null,["Select platform: [Android](/maps/documentation/android-sdk/dds-datasets/start \"View this page for the Android platform docs.\") [iOS](/maps/documentation/ios-sdk/dds-datasets/start \"View this page for the iOS platform docs.\") [JavaScript](/maps/documentation/javascript/dds-datasets/start \"View this page for the JavaScript platform docs.\")\n\n\u003cbr /\u003e\n\nFollow these steps to get set up with data-driven styling for datasets.\n\nGet an API key and enable APIs\n\nBefore using data-driven styling for datasets, you need:\nCloud project with a billing account, and both the\nMaps SDK for Android and the Maps Datasets API\nenabled. To learn more, see:\n\n- [Set up your Google Cloud project](/maps/documentation/android-sdk/cloud-setup)\n\n- [Enable Maps SDK for Android and get an API key](/maps/documentation/android-sdk/get-api-key)\n\n- [Enable the Maps Datasets API](https://console.cloud.google.com/apis/library/mapsplatformdatasets.googleapis.com)\n\nEnable the new maps renderer\n\nAn upgraded map renderer is available as of version 18.0.0 of the\nMaps SDK for Android. This renderer brings many improvements, including\nsupport for Cloud-based maps styling, to Maps SDK for Android.\n\nWith the release of version 18.2.0 of the Maps SDK for Android, Google switched the\ndefault renderer from the legacy renderer to the upgraded map renderer. This\nchange means that the upgraded map renderer is now used by default in your app\nwhen you build a new app or rebuild an existing app.\n| **Caution:** To use data-driven styling for datasets in your app, your app must be built using the upgraded map renderer. If you are adding data-driven styling for datasets to an existing app, rebuild the app to use the upgraded map renderer. For more information, see [New Map Renderer](/maps/documentation/android-sdk/renderer).\n\nCreate a map ID\n\nTo create a new map ID, follow the steps at\n[Create a map ID](/maps/documentation/get-map-id#create-a-map-id). Be sure to\nset the Map type to **Android**.\n\nCreate a new map style\n\nTo create a new map style, follow the instructions in\n[Create and use map styles](/maps/documentation/android-sdk/cloud-customization/map-styles)\nto create the style, and\n[associate the style with the map ID you just created](/maps/documentation/android-sdk/cloud-customization/map-styles#associate-style-with-map-id).\n\nUpdate your map initialization code\n\nThis step requires the map ID you just created. It can be found on your\n[Maps Management](https://console.cloud.google.com/google/maps-apis/studio/maps) page.\n\nTo add the map ID to your initialization code, see\n[Add the map ID to your app](/maps/documentation/get-map-id#add-a-map-id-to-your-app).\n\nCheck map capabilities (required)\n\nData-driven styling for datasets requires a map ID. If the map ID is missing, or an\ninvalid map ID is passed, data-driven styling for datasets cannot load. As a\ntroubleshooting step, you can use\n[`MapCapabilities`](/android/reference/com/google/android/gms/maps/model/MapCapabilities)\nto check if data-driven styling for datasets is supported.\n| **Caution:** Some devices might not support the new map renderer and therefore cannot display data-driven styling for datasets. You must use `MapCapabilities` to check for support at runtime. If data-driven styling for datasets is not supported, define a fallback option. For device requirements for the new map renderer, see [Supported\ndevices](/maps/documentation/android-sdk/renderer#supported-devices). \n\nKotlin\n\n\n```java\nval capabilities: MapCapabilities = googleMap.getMapCapabilities()\nSystem.out.println(\"Data-driven Styling is available: \" + capabilities.isDataDrivenStylingAvailable())\n```\n\n\u003cbr /\u003e\n\nJava\n\n\n```java\nMapCapabilities capabilities = googleMap.getMapCapabilities();\nSystem.out.println(\"Data-driven Styling is available: \" + capabilities.isDataDrivenStylingAvailable());\n```\n\n\u003cbr /\u003e\n\nNext steps\n\n- [Create and manage a dataset](/maps/documentation/android-sdk/dds-datasets/create-dataset)"]]