在Google Maps JavaScript API v3中获取当前位置,并在没有用户交互的情况下让点跟随我 [英] Get current position in Google Maps JavaScript API v3 and get the dot to follow me without user interaction

查看:68
本文介绍了在Google Maps JavaScript API v3中获取当前位置,并在没有用户交互的情况下让点跟随我的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我认为这是不可能或不可取的,因为网络的性质,但我会问。

我知道我可以得到用户的当前位置,使用Google Maps JavaScript API v3在地图上居中。我甚至可以让它显示用户当前位置的一个点。



我真正想知道的和我的客户正在问这个问题,我可以让用户在没有用户交互的情况下跟踪用户(即用户不会与设备进行交互,用户移动时点就会移动)。我能想到的是,我需要添加一个计时器事件来连续检查当前位置并更新点。我不觉得这是最好的做法。



我发现了很多关于如何在android或iOS设备上执行此操作的帖子,但不是在web上。 / p>

任何指针和信息都将不胜感激。



谢谢
Russ

解决方案

这正是您需要的 1



工作示例如下: 2

好运:)
已更新:链接现在指向新位置git hub


I am assuming this is not possible or advisable due to the nature of the web but I will ask anyway.

I know I can get a user's current location and centre on a map using the Google Maps JavaScript API v3. I can even get it to show a dot for where the user is currently located.

What I really want to know, and my client is asking for this, is can I get the dot to follow the user around without user interaction (ie.. the user does not interact with the device, the dot just moves when the user moves.)? All I can think of is that I would need to add a timer event to continuously check the current location and update the dot. I don't feel this would be best practice.

I have found lots of posts on how to do this in an android or IOS device but not on the web.

Any pointers and info will be greatly appreciated.

thanks Russ

解决方案

This is exactly what you need 1

The working example is here: 2

Good Luck :) UPDATED: The Links are now pointing to the new location on git hub

这篇关于在Google Maps JavaScript API v3中获取当前位置,并在没有用户交互的情况下让点跟随我的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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