Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Convert CLLocation or CLLocationCoordinate2D to CGPoint

How can I convert CLLocation or CLLocationCoordinate2D to CGPoint. I have seen

CGPoint point = [mapView convertCoordinate:myCoordinates toPointToView:self.view];

But I don't need to use mapView in my case. I tried googling, but didn't come across anything helpful.

Edit: I need to convert the geographic coordinates to iPad's screen coordinate as in Convert decimal latitude/longitude coordinates to iPad screen coordinates. I am trying to draw line/path based on the converted coordinate values.

Is there a direct way to do it, or do I need to write an algorithm to do the same.

like image 949
Xavi Valero Avatar asked Jun 21 '13 11:06

Xavi Valero


1 Answers

CGPoint myPoint = CGPointMake(coordinate.longitude, coordinate.latitude);

Note that the axes are swapped. But unless you give a coordinate system that you want the coordinate converted to, your question doesn't make sense.

like image 106
nevan king Avatar answered Sep 17 '22 20:09

nevan king