是否可以使用Google为iOS绘制用户当前位置和选择的目的地之间的路由?我在很多网页上看到谷歌不允许这样做,是吗?如果是这样的话,iPhone的Google应用程序是如何做到这一点的?
请分享你的想法。
发布于 2014-01-06 20:23:08
Maps SDK允许您在地图上绘制折线。请参阅https://developers.google.com/maps/documentation/ios/shapes
当您查询位置A到B的方向时,Google为您提供了折线。参见https://developers.google.com/maps/documentation/directions/#JSON
我不认为Maps SDK可以直接使用Direction提供的格式,但是您必须自己处理。有关此问题的解决方案,请参阅此线程:How to decode the Google Directions API polylines field into lat long points in objective-C for iPhone?
希望这能有所帮助!
发布于 2015-07-19 17:23:35
是的,使用下面的代码,您可以获得GMSPolyline对象,您可以通过设置其map属性将其添加到Google。
+(GMSPolyline *)googlePolylineWithGoogleEncoded:(NSString *)encodedString
{
GMSMutablePath *path = [GMSMutablePath pathFromEncodedPath:encodedString];
GMSPolyline *polyline = [GMSPolyline polylineWithPath:path];
return polyline;
}https://stackoverflow.com/questions/20956793
复制相似问题