管理重叠的样式
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
在基本地图上,当采用某些缩放级别时,有些地图项会相互重叠。发生重叠时,您可能无法看到自定义样式,因为另一个地图项样式完全或部分遮盖了您设置的样式。如果重叠的地图项是半透明的,该地图项会改变颜色。
如果您正在设置地图项的样式,但没有看到所做的更改呈现出来,则可能是因为存在地图项重叠的情况。下面是一些示例:
地图项完全重叠:地图注点 > 自然保护区地图项可能与自然 > 植被地图项重叠。例如,如果您正在设置国家公园的样式,黄石公园绝不会显示自然保护区样式,因为植被地图项覆盖了该样式。

另一个例子是部分停车场的停车位地图项和建筑物地图项重叠。
透明地图项与其他地图项重叠:如果透明地图项与其他地图项重叠,则在某些缩放级别下透明地图项会显示为叠加层。例如,下面两张图中显示医院的样式为红色。在第一张图中,建筑物地图项样式叠加在医院地图项样式上,但它是半透明的,因此会改变颜色。在第二张图中,建筑物地图项的可见性设为关闭,因此会显示所选的样式,即纯红色。

查找重叠的地图项
要确定是哪些重叠的地图项影响了您的呈现效果,请按以下步骤操作:
如果您知道重叠的地图项是什么,请将疑似重叠的地图项的可见性设为关闭,然后再看看您的样式是否按预期显示。
尝试关闭最有可能重叠的地图项,例如建筑物或自然。
如果您仍然没有找到,请依次将其他顶层地图项的可见性设为关闭,在此过程中观察地图上您的样式何时按预期显示。
将范围缩小到某个顶层地图项后,测试其下层的地图项以找出重叠的地图项。
管理重叠的地图项
找出哪些地图项重叠后,您有以下几个选择:
将重叠地图项的可见性设为关闭:这项更改会从地图中移除相应的地图项。
为重叠的地图项也设置样式:通过为重叠的地图项设置样式,您可以更改目标地图项以外的地图项,使其样式与您要更改或添加的样式更兼容。
改而为重叠的地图项设置样式:不妨考虑为重叠的地图项设置样式,而不是为原来的地图项设置,前提是这样做符合您的需要。
保持重叠状态:就像上面的医院示例中那样,有时也可以保留叠加效果,而不是一定要将所有建筑物的可见性设为关闭。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-08-31。
[null,null,["最后更新时间 (UTC):2025-08-31。"],[],[],null,["# Manage styles that overlap\n\nSelect platform: [Android](/maps/documentation/android-sdk/cloud-customization/overlap \"View this page for the Android platform docs.\") [iOS](/maps/documentation/ios-sdk/cloud-customization/overlap \"View this page for the iOS platform docs.\") [JavaScript](/maps/documentation/javascript/cloud-customization/overlap \"View this page for the JavaScript platform docs.\") [Web Service](/maps/documentation/maps-static/cloud-customization/overlap \"View this page for the Web Service platform docs.\")\n\n\u003cbr /\u003e\n\nOn the base map, some map features overlap each other at certain\nzoom levels. When overlapping happens, you might not see a custom style appear\nbecause another map feature style completely or partially obscures the style\nyou set. If the overlapping map feature is partially transparent, it changes\nthe color.\n\nIf you are styling a map feature, and aren't seeing your changes appear,\nit may be because there is an overlapping map feature. Here are some examples:\n\n- **Map features completely overlap** : The map feature **POI\\\u003eNature Reserve**\n may overlap with a **Natural\\\u003eVegetation** map feature. For example, if you\n are styling national parks, Yellowstone never shows the **Nature Reserve**\n style because the **Vegetation** map feature covers it.\n\n Another example is some parking garages have map features of parking\n and building overlapping.\n- **A transparent map feature overlaps another** : If a transparent map feature\n overlaps another map features, it appears as an overlay\n at some zoom levels. For example, these two images show hospitals\n styled as red. In the first, the **Building** map feature style overlays the\n **Hospital** map feature, but is semi-transparent, so it alters the color.\n In the second image, the building map feature **Visibility** is **Off**,\n so it shows the chosen style--a solid red.\n\n\nFind map features that overlap\n------------------------------\n\nTo figure out which overlapping map features affect your results,\ntake the following steps:\n\n1. If you have an idea what the overlapping map feature is, turn\n the **Visibility Off** for your suspected overlapping map feature, and\n see if your style appears as expected.\n\n2. Try turning off the most likely suspects, like **Building** or **Natural**.\n\n3. If you still haven't found it, start by turning **Visibility Off** on\n the other top-level map features in turn, watching the map for when\n your styling appears as expected.\n\n4. When you've narrowed it down to a top-level feature, test the map\n features under it to pinpoint the overlapping feature or features.\n\nManage overlapping map features\n-------------------------------\n\nOnce you figure out which map features are overlapping, you have a few choices:\n\n- **Turn visibility off on the overlapping map feature**: This change\n removes the map feature from the map.\n\n- **Style the overlapping feature as well**: By styling the overlapping\n map feature, you change a feature other than the one you intended so that\n its styling is more compatible with the style you want to change or add.\n\n- **Style the overlapping feature instead**: If it works for your needs,\n style the overlapping feature instead of the original map feature.\n\n- **Leave it overlapping**: As in the hospital example above, sometimes it\n works to leave the overlay effect, rather than turn off visibility for\n all buildings."]]