1
我正在嘗試將標記沿着兩個選定的標記以及它們的座標設置。如何迭代Google Directions API的路徑?
我從這個代碼得到的路徑:
GMSPath *path1 =[GMSPath pathFromEncodedPath:self.dataReceive[@"routes"][0][@"overview_polyline"][@"points"]];
當我使用for循環到第一標記移動到第二標記的位置。它採取了直線路徑,但它應該沿着從google方向API獲取的路徑座標移動。
for (int i = 0; i< path1.count; i++) {
CLLocationCoordinate2D position = [path1 coordinateAtIndex:i];
[CATransaction begin];
[CATransaction setAnimationDuration:50];
self.marker.position = position;
self.marker.map = self.mapView;
[CATransaction commit];
}
謝謝。