2

Hello for a navigation based application i need to get CGPoint from coordinates OR MKMapPoint of a MKMapView. I want to draw a line between these points but not a poly line.

I know all about MKPolyLine and other custom polyLines but due to some specific condition i have to get CGPoint from coordinates OR MKMapPoint..

I know how to get coordinates from CGPoint

CLLocationCoordinate2D touchMapCoordinate 
    = [mapView convertPoint:touchPoint toCoordinateFromView:mapView];

But i want reverse also.... I know how to get MKMapPoint

MKMapPoint  mp = MKMapPointForCoordinate(aCoordinate);

but dont know how to convert MKMapPoint to CGPoint. Please help me.

Peter Hosey
  • 95,783
  • 15
  • 211
  • 370
Nirav Gadhiya
  • 6,342
  • 2
  • 37
  • 76

1 Answers1

4

to convert co-ordinates to CGPoint, use below method

CGPoint point = [mapView convertCoordinate:location toPointToView:overlayView];

here location is CLLocationCoordinate2D object which has map latitude and longitude and overlayView is a view where you need to draw the polylines.

Ankur
  • 5,086
  • 19
  • 37
  • 62