在Google地图上跳跃标记 [英] Jumping markers on Google maps

查看:78
本文介绍了在Google地图上跳跃标记的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在构建一个使用Rails 4和Gmaps4Rails gem将Google Map添加到页面的小型站点.

I'm building a small site that uses Rails 4 and Gmaps4Rails gem to add a Google Map to the page.

除了在我平移或缩放地图时会根据其地理编码位置放置在地图上的标记跳来跳去之外,它的效果非常好.我的意思是,同一标记最终会出现在稍微不同的位置!

It works quite well except that the markers that are placed on the map based on their geo coded location jump around when I pan or zoom the map. What I mean with this is that the same marker ends up at a slightly different location!

标记基于地图的边界,即我使用Geokit来获取在当前地图上可见的标记.每当地图空闲时,即停止平移或缩放时,都会触发此过程.因此,标记将被替换-旧标记将被删除,而新标记将被添加.

The markers are based on the map's boundary, i.e. I use Geokit to get the markers that are visible on the current map. This process is triggered every time the map becomes idle, i.e. stopped panning or zooming. So, the markers will be replaced - old ones are removed and new ones are added.

我的期望是,每次将相同的标记添加到地图时,它们都会在相同的位置结束.它不是!这是众所周知的功能"还是在我这边有问题?

My expectation is that the same marker would end up at the same location every time it is added to the map. It does not! Is this a well known "feature" or maybe I have something wrong on my side?

我使用Rails 4.0.1和Gmaps4Rails 2.1.0.

I use Rails 4.0.1 and Gmaps4Rails 2.1.0.

请让我知道我可以分享的其他信息,以便找出我可能做错的事情.

Please let me know what other information I can share in order to find out what I might have done wrong on my side.

提前谢谢!

推荐答案

它是防止重叠的功能.它记录在此处的代码中.

Its a feature to prevent overlapping. Its documented in the code here.

您可以自定义或删除行为,例如:

You can customise or remove the behaviour, example:

handler = Gmaps.build('Google', { markers: { maxRandomDistance: null } });

这篇关于在Google地图上跳跃标记的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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