Google Maps iOS SDK,获取2个位置之间的路线 [英] Google Maps iOS SDK, Getting Directions between 2 locations

查看:84
本文介绍了Google Maps iOS SDK,获取2个位置之间的路线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我使用Google Maps SDK时,我试图在iOS上的两个位置之间取得驾驶方向。我知道我们可以使用两种方法来做到这一点: -



1。)使用URL Scheme,必须在您的设备上安装Google地图应用程序。

现在,我的问题是否有任何其他方式可以在iOS上执行此操作?我需要显示从当前位置到特定位置的方向,其中我有Lat / Long。



我的意思是不可能简单地通过2个位置作为参数和谷歌地图SDK,会给我的方向?



谢谢,

解决方案这听起来像你正在寻找像谷歌地图应用程序显示方向的用户界面的Chrome。 Google Maps SDK for iOS会为您绘制一张地图,但是您需要为其他导航项目负责。



您可以使用 Google Directions API 来请求路线,然后使用从服务返回的编码路径来绘制 GMSPolyline ,使用 GMSPath的pathFromEncodedPath:方法。


While I am using Google Maps SDK, I am trying to get driving direction between two locations on iOS. I know we can do this using two methods:-

1.) Using URL Scheme, for which it is necessary that Google Maps App is installed on your device.

2.) Using Directions API, via Request-Response and then parsing the JSON. Displaying markers to show the direction.

Now, my question is there any other way by which I can do this on iOS? I need to show the direction from my current location to a particular location of which i have the Lat/Long.

I mean is it really not possible to simply pass 2 location as parameter and Google Maps SDK, will give me the directions?

Thanks,

解决方案

It sounds like you are looking for UI Chrome like the Google Maps app has for showing directions. Google Maps SDK for iOS will paint you a map, but you are responsible for the additional navigation chrome.

You can use the Google Directions API to request directions, and then use the encoded path returned from the service to draw a GMSPolyline using GMSPath's pathFromEncodedPath: method.

这篇关于Google Maps iOS SDK,获取2个位置之间的路线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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