谷歌地图ios没有显示道路上的确切路线

时间:2015-07-16 06:21:22

标签: ios google-maps google-maps-sdk-ios

谷歌地图ios - 没有显示路线远离道路的长路线图。

enter image description here

用于显示路径的代码:

- (void)addDirections:(NSDictionary *)json {

    if ([json objectForKey:@"routes"]) {
        if ([[json objectForKey:@"routes"] count] > 0) {
            NSDictionary *routes = [json objectForKey:@"routes"][0];

            NSDictionary *route = [routes objectForKey:@"overview_polyline"];
            NSString *overview_route = [route objectForKey:@"points"];
            GMSPath *path = [GMSPath pathFromEncodedPath:overview_route];
            GMSPolyline *polyline = [GMSPolyline polylineWithPath:path];
            polyline.map = mapView_;
            polyline.strokeColor = [UIColor redColor];
            polyline.strokeWidth = 10.f;
            polyline.geodesic = YES;
        }

    }

}

0 个答案:

没有答案