概览
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
借助数据集的数据驱动型样式,您可以上传自己的地理空间数据集,将自定义样式应用于数据地图项,以及在地图上显示这些数据地图项。此外,您还可以根据点、多段线和多边形几何图形创建数据可视化内容,并使数据地图项响应点击事件。仅矢量地图支持数据集的数据驱动型样式(必须提供地图 ID)。
开始使用数据集的数据驱动型样式
添加自定义地理空间数据集
使用 Google Cloud 控制台或 Google Cloud Shell 添加自定义数据。每个数据集的 ID 都是唯一的,可用于将数据集与地图样式相关联。下面列出了支持的数据格式:
- GeoJSON
- 以英文逗号分隔 (CSV)
- KML
如需详细了解与数据集相关的要求和限制,请参阅创建和管理数据集
关于公共数据集
如需设置数据集的样式,您必须将地图样式与地图 ID 相关联,这样也会将数据集与地图 ID 相关联。在应用中,开发者可以引用该地图 ID 以及与之关联的任何地图样式和地理空间数据。不会对地理空间数据应用任何额外的访问权限控制,因此地理空间数据实际上可供拥有该应用的任何人公开访问。
设置数据地图项的样式
上传自定义数据并将其与地图样式和地图 ID 相关联后,便可以设置数据地图项的样式,使其产生视觉效果,并使地图项响应点击事件。
设置点数据的样式以在地图上显示特定位置。
设置多段线数据的样式以突出地貌。
设置多边形数据的样式以突出地理区域。
通过添加事件监听器使数据地图项响应点击事件。
在渲染大量数据要素时,您可能会发现应用存在性能问题。例如,在缩放或旋转时,您可能会发现应用存在性能滞后或稳定性问题。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-08-31。
[null,null,["最后更新时间 (UTC):2025-08-31。"],[[["\u003cp\u003eData-driven styling allows you to upload, style, and display custom geospatial datasets (GeoJSON, CSV, KML) on vector maps using Google Maps Platform.\u003c/p\u003e\n"],["\u003cp\u003eDatasets are associated with map styles and IDs, enabling data visualization and interactivity based on point, polyline, and polygon geometries.\u003c/p\u003e\n"],["\u003cp\u003ePublic datasets, when linked to a map ID, become accessible to anyone with the app using that ID, requiring awareness regarding data sensitivity.\u003c/p\u003e\n"],["\u003cp\u003eData features can be styled for visual impact and interactivity, such as highlighting locations, geographical features, areas, and responding to click events.\u003c/p\u003e\n"],["\u003cp\u003eRendering a large number of data features might impact app performance, potentially causing lag or stability issues during zoom or rotate operations.\u003c/p\u003e\n"]]],[],null,["Select platform: [Android](/maps/documentation/android-sdk/dds-datasets/overview \"View this page for the Android platform docs.\") [iOS](/maps/documentation/ios-sdk/dds-datasets/overview \"View this page for the iOS platform docs.\") [JavaScript](/maps/documentation/javascript/dds-datasets/overview \"View this page for the JavaScript platform docs.\")\n\n\u003cbr /\u003e\n\nData-driven styling for datasets lets you upload your own geospatial datasets,\napply custom styling to their data features, and display those data features on\nmaps. With data-driven styling for datasets, you can create data visualizations\nbased on point, polyline, and polygon geometries, and make data features respond\nto click events. Data-driven styling for datasets is supported on vector maps\nonly (a map ID is required).\n\n[Get started with data-driven styling for datasets](/maps/documentation/android-sdk/dds-datasets/start)\n\nAdd custom geospatial datasets\n\nAdd your custom data using Google Cloud Console or Google Cloud\nShell. Each dataset has a unique ID, which you can associate with a map style.\nThe following data formats are supported:\n\n- GeoJSON\n- Comma-separated (CSV)\n- KML\n\nFor details about dataset requirements and limitations, see\n[Create and manage a dataset](/maps/documentation/android-sdk/dds-datasets/create-dataset#dataset-prerequisites)\n\nAbout public datasets\n\nIn order to style a dataset you must associate a map style with a map ID, which\nalso associates the dataset to the map ID. In an app, developers can reference\nthat map ID, and any map style and geospatial data associated with it. No\nadditional access control is applied to the geospatial data, making the\ngeospatial data effectively publicly available to anyone with the app.\n\nStyle data features\n\nOnce your custom data has been uploaded and associated to a map\nstyle and map ID, you can style data features for visual impact, and make\nfeatures respond to click events.\n\nStyle point data to show specific locations on the map.\n\nStyle polyline data to highlight geographical features.\n\nStyle polygon data to highlight geographical areas.\n\nMake data features respond to click events by adding an event\nlistener.\n\nPerformance when rendering a large number of data features\n\nWhen rendering a large number of data features, you might notice performance\nissues in your app. For example, you might notice a performance lag or stability\nissues with the app during a zoom or rotate."]]