title: How to whether the UserLocation is inside a MKPolygonview or particular region in iOS MKMapView?
body: <p>I need to check whether the current user location is inside a particular region, here I use a <code>MKPolygonView</code>.I had  added a route in my <code>MKMapView</code> and I want to check whether the user is in that particular route or not . I tried the following code but it shows always that I'm in wrong path even if am in that region.
  Any idea where I had gone wrong?
  Any help will be appreciated.
  Thanks.</p>
  
  <pre><code>    BOOL exist = NO;
      CLLocationCoordinate2D mapCoordinate = newLocation.coordinate;//user location or annot coord
      MKMapPoint mapPoint = MKMapPointForCoordinate(mapCoordinate);
      for(MKPolyline *routeLine in overlays)
      {
  
          NSLog(@"Overlays array count = %d",overlays.count);
          MKPolygonView *polygonView =(MKPolygonView *)[mapView viewForOverlay:routeLine];
          CGPoint polygonViewPoint = [polygonView pointForMapPoint:mapPoint];
          BOOL mapCoordinateIsInPolygon = CGPathContainsPoint(polygonView.path, NULL, polygonViewPoint, NO);
          NSLog(@"mapcoordinate %c",mapCoordinateIsInPolygon);
          if(mapCoordinateIsInPolygon)
          {
              exist = YES;
          }
          else
          {
              exist = NO;
  
          }
      }
  </code></pre>