NSArray *splitPoints = [routeGeom componentsSeparatedByString:@"], ["];
routePoints = malloc(sizeof(CLLocationCoordinate2D) * ([splitPoints count] + 1));
int i=0;
NSArray *coords;
for (NSString* coordStr in splitPoints) {
coords = [coordStr componentsSeparatedByString:@","];
routePoints[i].latitude = [[[coords objectAtIndex:0] substringFromIndex:1]floatValue];
routePoints[i].longitude = [[coords objectAtIndex:1] floatValue];
i++;
}
[coords release];
NSLog(@"** Time to split the route geometry into structs %f", [NSDate timeIntervalSinceReferenceDate] - start);
source
share