1

When i am using the below code it is giving me a straight polyline, but i want zigzag according to the route as shown in image i posted.I am using following code.

GMSMarker *marker = [[GMSMarker alloc] init];
marker.position = CLLocationCoordinate2DMake(center.latitude,center.longitude);
marker.title = @"";
marker.snippet = @"";
//marker.map = mapView_;
marker.map = self.mapView;

marker.groundAnchor=CGPointMake(0.5,0.5);
marker.map=_mapView;
GMSMutablePath *path = [GMSMutablePath path];
[path addCoordinate:CLLocationCoordinate2DMake(userLatitude,userLongitude)];
[path addCoordinate:CLLocationCoordinate2DMake(center.latitude,center.longitude)];

GMSPolyline *rectangle = [GMSPolyline polylineWithPath:path];
rectangle.strokeWidth = 2.f;
rectangle.map = _mapView;
self.view=_mapView;

[1]: https://i.stack.imgur.com/mVvIV.png
iDeveloper
  • 940
  • 1
  • 10
  • 45
techno
  • 55
  • 7

1 Answers1

0

I think what you might be looking for is to get the directions from Google Directions API and then draw the polylines along that path. Maybe this is what you are looking for.

Community
  • 1
  • 1