I was just curious what the correct way to draw a simple route line between a set of points was? I currently have an array of coordinates and when I pass it to polylineWithCoordinates and do all the other necessary things, it draws a big web of lines that interconnect all of the points to one another. I’ve looked at a few samples but none of them seem to do anything special to account for this, even when they use more than two points.
- (void)viewDidLoad
{
[super viewDidLoad];
...
//Add drawing of route line
CLLocationCoordinate2D coordinates[[myCheckpoints count]];
int i = 0;
for (Checkpoint *ckpt in myCheckpoints)
{
coordinates[i] = CLLocationCoordinate2DMake([ckpt.lat floatValue] , [ckpt.lon floatValue]);
i++;
}
MKPolyline *route = [MKPolyline polylineWithCoordinates: coordinates count: [myCheckpoints count]];
[mapView addOverlay:route];
}
- (MKOverlayView *)mapView:(MKMapView *)mapView viewForOverlay:(id <MKOverlay>)overlay {
MKPolylineView *polylineView = [[[MKPolylineView alloc] initWithPolyline:overlay] autorelease];
polylineView.strokeColor = [UIColor greenColor];
polylineView.lineWidth = 5.0;
return polylineView;
}
This is the code in my mapViewController that is responsible for the drawing, just in case somebody sees what I’m doing, or not doing.

Now that I look at everything much closer, is actually not connecting adjacent coordinates to each other. Each point only has 2 lines stemming from it connecting that point to 2 more points but I cant figure out the pattern its connecting them in.
Make sure the coordinates in myCheckpoints are in the order that you want the lines drawn in.
It will draw the lines in the order the coordinates are provided.