谷歌地图 API V3 - 同一地点的多个标记 [英] Google maps API V3 - multiple markers on exact same spot

查看:25
本文介绍了谷歌地图 API V3 - 同一地点的多个标记的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有点卡在这个上.我正在通过 JSON 检索地理坐标列表并将它们弹出到谷歌地图上.除了在完全相同的位置有两个或更多标记的情况外,一切都运行良好.API 仅显示 1 个标记 - 最上面的标记.我想这很公平,但我想找到一种方法来以某种方式显示它们.

Bit stuck on this one. I am retrieving a list of geo coords via JSON and popping them onto a google map. All is working well except in the instance when I have two or more markers on the exact same spot. The API only displays 1 marker - the top one. This is fair enough I suppose but would like to find a way to display them all somehow.

我在谷歌上搜索并找到了一些解决方案,但它们似乎大多适用于 API 的 V2 或者不是那么好.理想情况下,我想要一个解决方案,您点击某种组标记,然后显示聚集在它们所在位置周围的标记.

I've searched google and found a few solutions but they mostly seem to be for V2 of the API or just not that great. Ideally I'd like a solution where you click some sort of group marker and that then shows the markers clustered around the spot they are all in.

有人遇到过这个问题或类似问题,愿意分享解决方案吗?

Anybody had this problem or similar and would care to share a solution?

推荐答案

看看 OverlappingMarkerSpiderfier.
有一个演示页面,但它们没有显示完全在同一位置的标记,只有一些非常靠近.

Take a look at OverlappingMarkerSpiderfier.
There's a demo page, but they don't show markers which are exactly on the same spot, only some which are very close together.

但是在 上可以看到在完全相同的位置带有标记的真实示例http://www.ejw.de/ejw-vor-ort/(向下滚动地图并点击几个标记以查看蜘蛛效果).

But a real life example with markers on the exact same spot can be seen on http://www.ejw.de/ejw-vor-ort/ (scroll down for the map and click on a few markers to see the spider-effect).

这似乎是您问题的完美解决方案.

That seems to be the perfect solution for your problem.

这篇关于谷歌地图 API V3 - 同一地点的多个标记的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆