Google 地图 API v3 标记重叠
我正在使用谷歌地图制作一个应用程序。
当标记重叠时,即使图标不同,也仅显示最后一个。
我不希望它在这种情况下聚集,而是应该通过更改坐标来显示两者,但是?
有什么解决办法吗??
I am making an application with google maps.
When markers are overlapping only the last one is displayed even if the icons are different..
I do not want it to cluster in that case, rather it should show both maybe by changing the coordinates just a but??
Any solutions??
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我认为这是一个非常优雅的解决方案,称为“蜘蛛化标记”。
https://github.com/jawj/OverlappingMarkerSpiderfier
我正在考虑使用它。
我现在做的是使用 JavaScript 制作一个精美的弹出窗口,隐藏和显示一个标记位置上的 div(在 PHP 中创建有问题,但您也可以在 JS 上执行此操作)。它的另一个好处是可以减少地图上的标记。
单击此地图上的黑色编号标记即可查看其实际情况。
http://www.yourmapper。 com/map/111/crime-reports/crime-in-metro-louisville-ky-since-jan-2003.htm
I think this is a pretty elegant solution, called Spiderfying the markers.
https://github.com/jawj/OverlappingMarkerSpiderfier
I'm thinking of using it.
What I do now is use JavaScript to make a fancy popup that hides and shows divs on one marker location (created problematically in PHP, but you could do it on JS too). It has the side benefit of allowing less markers on the map.
Click a black numbered marker on this map to see it in action.
http://www.yourmapper.com/map/111/crime-reports/crime-in-metro-louisville-ky-since-jan-2003.htm
另一种选择是使用 Google Maps API 3 实用程序库,它有一个Marker Clusterer。
Another option is to use Google Maps API 3 Utility Library, it has a Marker Clusterer.