Testing Testing
Testing Testing

Reputation: 95

show route between multiple Annotations

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

Answers (2)

fibnochi
fibnochi

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

Hiren
Hiren

Reputation: 12780

try out with this tutorial link, it shows only single route between two points. you need to change as per your requirement. for 10km distance. you have to calculate distance using both point's (latitude, longitude).

Upvotes: 2

Related Questions