使用谷歌地图删除路线 [英] remove route with google map

查看:154
本文介绍了使用谷歌地图删除路线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我收到了一个使用Google地图的方向服务功能的小应用程序。它运行良好,我可以改变路线,但是我遇到了一个小问题,用户在追踪路线后可以返回到一系列标记。



我可以找不到用google map删除路线的方法。对于标记,我存储它们并执行 setMap(null),在这里没有看到...

解决方案

如果您正在使用DirectionsRenderer显示路由,您也可以在其上调用setMap(null)。这样您就可以删除显示的路线。



使用此处的示例代码
http://code.google.com/apis/maps/documentation/javascript/examples/directions-simple.html

只需调用

  directionsDisplay.setMap(null); 


I got a small app that use the Direction Service feature of Google Map. It is working well, I can change routes, but I have a small problem, where a user could go back to a list of markers after tracing a route.

I can't find a way to delete routes with google map. For markers I store them and do setMap(null), do not see a way here...

解决方案

if you are using DirectionsRenderer to display the routes, you can call setMap(null) on it too. That way you delete the displayed route.

Using the example code here http://code.google.com/apis/maps/documentation/javascript/examples/directions-simple.html

just call

directionsDisplay.setMap(null);

这篇关于使用谷歌地图删除路线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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