Ich habe versucht, eine Route mit Google Maps auf iOS, die von Google Direction API stammen, zu zeichnen. Ich traf diesen EndpunktHerkunft und Zielpunkt ist nicht genau in Google Maps SDK platziert
NSString *urlString = [NSString stringWithFormat:@"https://maps.googleapis.com/maps/api/directions/json?origin=%@&destination=%@&mode=driving&key=%@", origin, destination, gDirectionKey];
Dann habe ich ihre Routen, die ich mit 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;
zeichnen Es sieht aus wie, dass die Startlinie in seiner Koordinate startet nicht, aber in der nächsten Weg . Siehe Bild unten.
ist es möglich, seine Linie zu ziehen Koordinate in die „Start-Richtung“? Wenn ja, würde jede Hilfe geschätzt werden. Vielen Dank.
Sie können eine Polylinie zwischen Startlinie Koordinate & tatsächlichen Startpunkt zeichnen! –
Was bedeutet "Startrichtung"? –
Startrichtung ist Startpunkt von Google-Richtung Ergebnis. Der tatsächliche Startpunkt ist mein Ausgangspunkt, den ich als Parameter für die Google-Richtungs-API verwende –