1
我試圖使用來自Google方向API的iOS上的Google地圖繪製路線。 我打這個終點原始地點和目的地點未精確放置在Google地圖SDK上
NSString *urlString = [NSString stringWithFormat:@"https://maps.googleapis.com/maps/api/directions/json?origin=%@&destination=%@&mode=driving&key=%@", origin, destination, gDirectionKey];
然後我得到了它的路線,我與GMSPolyline
GMSPath *path =[GMSPath pathFromEncodedPath:resultData[@"routes"][0][@"overview_polyline"][@"points"]];
if (routeToCustomer == nil)
routeToCustomer = [[GMSPolyline alloc] init];
routeToCustomer.path = path;
routeToCustomer.strokeWidth = 7;
routeToCustomer.strokeColor = [UIColor colorWithHexString:ACTIVE_COLOR];
routeToCustomer.map = _mapView;
它看起來像起跑線不其座標開始繪製,但在最近的路。見下圖。
是否可以借鑑其行座標轉換「開始的方向」?如果是這樣,任何幫助將不勝感激。謝謝。
你可以在起始線座標和實際起點之間畫一條折線! –
「起始方向」是什麼意思? –
從谷歌方向結果開始方向是起點。實際的起點是我用作google方向API的參數的初始點 –