title: How to draw route between two locations and plot main points also using MapKit?
body: <p>I am using MapKit api to get current location on map and drawing route between two location pointed by drop pins.I also want to get all the main stands between its route.
  I m using below function to get route between two location</p>
  
  <pre><code>- (NSArray*)getRoutePointFrom:(MyLocation*)origin to:(MyLocation*)destination
  {
   NSString* saddr = [NSString stringWithFormat:@"%f,%f", origin.coordinate.latitude, origin.coordinate.longitude];
   NSString* daddr = [NSString stringWithFormat:@"%f,%f", destination.coordinate.latitude, destination.coordinate.longitude];
  
  
   NSURL *url=[NSURL URLWithString:[NSString stringWithFormat:@"http://maps.googleapis.com/maps/api/directions/json?origin=%@&amp;destination=%@&amp;sensor=false&amp;avoid=highways&amp;mode=driving",saddr,daddr]];
  
   NSError *error=nil;
  
   NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init] ;
  
   [request setURL:url];
   [request setHTTPMethod:@"POST"];
  
    NSURLResponse *response = nil;
  
    NSData *responseData = [NSURLConnection sendSynchronousRequest:request returningResponse:&amp;response error: &amp;error];
  
    NSString *responseString = [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding];
  
   SBJsonParser *json=[[SBJsonParser alloc] init];
  
   NSDictionary *dic=[json objectWithString:responseString error:nil];
  
   NSDictionary *nextdic=[dic valueForKey:@"routes"];
   NSDictionary *legdic=[nextdic valueForKey:@"legs"];
   NSDictionary *stepdic=[legdic valueForKey:@"steps"];
  
   NSArray *array=[[NSArray alloc] initWithArray:[[stepdic valueForKey:@"polyline"] valueForKey:@"points"]];  
  
  
   NSString *string=[NSString stringWithFormat:@"%@",[[array objectAtIndex:0] objectAtIndex:0]];
  
  
  
  
   return [self decodePolyLine:[string mutableCopy]];
  
  }
  
  
  
  -(NSMutableArray *)decodePolyLine:(NSString *)encodedStr 
  {  
  
   NSMutableString *encoded = [[NSMutableString alloc] initWithCapacity:[encodedStr length]];  
   [encoded appendString:encodedStr];  
   [encoded replaceOccurrencesOfString:@"\\\\" withString:@"\\"  
                               options:NSLiteralSearch  
                                 range:NSMakeRange(0, [encoded length])];  
   NSInteger len = [encoded length];  
  
   NSInteger index = 0;  
   NSMutableArray *array = [[NSMutableArray alloc] init] ;  
   NSInteger lat=0;  
   NSInteger lng=0;  
   while (index &lt; len) {  
    NSInteger b;  
    NSInteger shift = 0;  
    NSInteger result = 0;  
    do {  
     b = [encoded characterAtIndex:index++] - 63;  
     result |= (b &amp; 0x1f) &lt;&lt; shift;  
     shift += 5;  
    } while (b &gt;= 0x20);  
    NSInteger dlat = ((result &amp; 1) ? ~(result &gt;&gt; 1) : (result &gt;&gt; 1));  
    lat += dlat;  
    shift = 0;  
    result = 0;  
    do {  
     b = [encoded characterAtIndex:index++] - 63;  
     result |= (b &amp; 0x1f) &lt;&lt; shift;  
     shift += 5;  
    } while (b &gt;= 0x20);  
    NSInteger dlng = ((result &amp; 1) ? ~(result &gt;&gt; 1) : (result &gt;&gt; 1));  
    lng += dlng;  
    NSNumber *latitude = [[NSNumber alloc] initWithFloat:lat * 1e-5];  
    NSNumber *longitude = [[NSNumber alloc] initWithFloat:lng * 1e-5];  
    //          printf("[%f,", [latitude doubleValue]);  
    //          printf("%f]", [longitude doubleValue]);  
    CLLocation *loc =[[CLLocation alloc] initWithLatitude:[latitude floatValue] longitude:[longitude floatValue]] ;  
    [array addObject:loc];  
   }  
  
   NSLog(@"array in decode polygon is %@",array);
  
   return array;  
  }
  </code></pre>
  
  <p>but it is not working . .. </p>
  
  <p>help regarding this 
  thank you!...</p>