title: Draw poly line on the road in mkmap view - iphone
body: <p>i am making an navigation based application. In this application i am drawing a route from points selected by the user.</p>
  
  <p>for Calculating the route i have used <code>Google direction API</code>. and for drawing the route i have used this code</p>
  
  <pre><code>- (void) drawRoute:(NSArray *) path
  {
      NSInteger numberOfSteps = path.count;
      [self.objMapView removeOverlays: self.objMapView.overlays];
  
      CLLocationCoordinate2D coordinates[numberOfSteps];
      for (NSInteger index = 0; index &lt; numberOfSteps; index++)
      {
          CLLocation *location = [path objectAtIndex:index];
          CLLocationCoordinate2D coordinate = location.coordinate;
  
          coordinates[index] = coordinate;
      }
  
      for( id &lt;MKOverlay&gt; ovr in [self.objMapView overlays])
      {
          MKPolylineView *polylineView = [[MKPolylineView alloc] initWithPolyline:ovr];
  
  
          if (polylineView.tag == 22)
          {
              [self.objMapView removeOverlay:ovr];
          }
          [polylineView release];
      }
  
      MKPolyline *polyLine = [MKPolyline polylineWithCoordinates:coordinates count:numberOfSteps];
      [self.objMapView addOverlay:polyLine];
  
  
  }
  </code></pre>
  
  <p><strong>PROBLEM :~ When i am drawing a route i encountered a problem that it is not drawing polyline on the road. To explain this i have attached an image</strong></p>
  
  <p><img src="https://i.stack.imgur.com/CZbSF.png" alt="enter image description here"></p>
  
  <p>as shown in the picture polyline is not on the road.</p>
  
  <p>I have used <code>UICGDirections</code> but it is not working properly some times.</p>
  
  <p>Please help me i am new to mapview.</p>
  
  <p>Thanks in advance</p>