简体   繁体   中英

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM