Reputation: 95
I need to show route (path) between multiple annotations.they are located at different locations but in a range of say 10 km.
Upvotes: 1
Views: 761
Reputation: 1113
I think this may be helpful for you as i have done this for drawing rout between cities.
CLLocationCoordinate2D firstCoords;
firstCoords.latitude = lat1;
firstCoords.longitude = lng1;
CLLocationCoordinate2D secondCoords;
secondCoords.latitude=lat2;
secondCoords.longitude=lng2;
NSLog(@" %f", lat1);
NSLog(@" %f", lng1);
NSLog(@" %f", lat2);
NSLog(@" %f", lng2);
routeCoordinates[0] = CLLocationCoordinate2DMake(lat1, lng1);
routeCoordinates[1] = CLLocationCoordinate2DMake(lat2, lng2);
MKPolyline *routeLine = [MKPolyline polylineWithCoordinates:routeCoordinates count:2];
[mapView addOverlay:routeLine];
Upvotes: 3