Google Maps Platform 即将推出全新地图样式。此次地图样式更新包括全新默认调色板,以及地图体验和易用性方面的改进。所有地图样式将于 2025 年 3 月自动更新。如需详细了解适用范围以及如何提前选择启用,请参阅
全新 Google Maps Platform 地图样式。
概览
借助边界的数据驱动型样式,您可以使用 Google 多边形来表示行政边界,为边界多边形设置不同样式,在地图上显示这些多边形。
使用边界的数据驱动型样式,您可以按地点 ID 定位区域,并为地图上的边界多边形应用自定义样式。每种地图项类型都代表一类区域;在配置地图样式时,您可以选择要启用的地图项类型。如需了解各个国家/地区的边界覆盖范围,请参阅 Google 边界覆盖范围。
地图项类型
数据驱动型样式可让表示行政区的地图项类型使用 Google 边界数据。行政区按职能分类,例如国家/地区、州/省/直辖市/自治区、市行政区和邮政编码。地图项类型按行政级别排列,其结构因国家/地区而异。其中包括:
GMSFeatureTypeCountry
- 表示国家/地区政治实体,通常是具有最高级别的类型。
GMSFeatureTypeAdministrativeAreaLevel1
- 表示国家/地区级别以下的一级行政实体。在美国,这种行政级别就是州。
GMSFeatureTypeAdministrativeAreaLevel2
- 表示国家/地区级别以下的二级行政实体。在美国,这种行政级别就是县。
GMSFeatureTypeLocality
- 表示有建制的城市或城镇政治实体。
GMSFeatureTypePostalCode
- 表示国家/地区内邮寄地址所用的邮政编码。
GMSFeatureTypeSchoolDistrict
- 表示学区,包括联合学区、小学和中学。
行政区在地图上以地图项图层的形式显示;每类行政区都有自己的图层。地图项图层是按地图样式启用的。在 Google Cloud 控制台中设置地图样式时,您可以选择要启用的地图项图层。
设置边界多边形的样式
您可以为边界多边形应用填充样式(颜色、不透明度)和描边样式(颜色、不透明度、描边粗细)。通过样式设置,您可以:
- 设置边界多边形的样式或显示某个地图项类型的所有边界。
- 创建分级统计图。
Google 边界覆盖范围页面显示了在各个国家/地区可以使用哪些地图项类型。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-01-14。
[null,null,["最后更新时间 (UTC):2025-01-14。"],[[["Data-driven styling enables applying custom styles to Google's administrative boundary polygons on your maps, targeting regions by place ID."],["You can select specific feature types like countries, states, localities, and postal codes to display on your map."],["Boundary polygons can be styled with fill and stroke properties to create visual effects or choropleth maps."],["Google provides boundary data for various countries, and coverage details are available in the documentation."],["Data-driven styling is available across Android, iOS, and JavaScript platforms."]]],["Data-driven styling allows accessing and styling Google's administrative boundary polygons on maps. Users can target regions by place ID and apply custom styling to the polygons. Feature types, categorized by administrative level (e.g., country, state, locality, postal code, school district), are accessed via layers within map styles. Styling options include fill color and opacity, as well as stroke color, opacity, and weight, enabling the creation of choropleth maps or individual boundary styles. Availability of these feature types varies by country.\n"]]