简体   繁体   English

google maps api:显示箭头以指示在地图上不存在标记

[英]google maps api: display an arrow to indicate that there is a marker not visible on the map

I've an html application that uses javascript Google Maps API to display some points (markers). 我有一个使用javascript Google Maps API来显示一些点(标记)的html应用程序。 Some of the points may not be visible in the current user map (due to zoom, position, etc.). 有些点可能在当前用户地图中不可见(由于缩放,位置等)。 I was looking for somehow to represent this points, for example, an arrow on near the border of the map indicating the direction. 我一直在寻找表示这些点的方法,例如,地图边界附近的箭头指示方向。

Is there any function / library that may help? 是否有任何功能/库可能会有所帮助?

In case there isn't. 万一没有。 I've analyzes how to implement this by myself. 我已经分析了如何自己实现这一点。 The direction of the arrow can be achieved by (MarkerPosition - CenterPosition).normalize(). 箭头的方向可以通过(MarkerPosition-CenterPosition).normalize()来实现。 However, how can I draw that arrow in the correct position on the border of the map? 但是,如何在地图边框上的正确位置绘制该箭头?

Thanks! 谢谢!

I've developed a solution to the problem. 我已经解决了这个问题。 Source code can be found at github.com 源代码可以在github.com上找到

https://github.com/mateuyabar/GmapsHiddenMarkers https://github.com/mateuyabar/GmapsHiddenMarkers

And a sample map 样本图

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM