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

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

问题描述

我有一个使用 Google 地图的方向服务功能的小应用程序.它运行良好,我可以更改路线,但我有一个小问题,用户可以在跟踪路线后返回到标记列表.

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.

我找不到用谷歌地图删除路线的方法.对于标记,我存储它们并执行 setMap(null),在这里看不到方法...

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...

推荐答案

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

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

在此处使用示例代码http://code.google.com/apis/maps/documentation/javascript/示例/方向-simple.html

打电话

directionsDisplay.setMap(null);

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

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