[英]Convert CLLocation or CLLocationCoordinate2D to CGPoint
How can I convert CLLocation
or CLLocationCoordinate2D
to CGPoint
. 如何将
CLLocation
或CLLocationCoordinate2D
转换为CGPoint
。 I have seen 我见过
CGPoint point = [mapView convertCoordinate:myCoordinates toPointToView:self.view];
But I don't need to use mapView
in my case. 但我不需要在我的情况下使用
mapView
。 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 . 编辑:我需要将地理坐标转换为iPad的屏幕坐标,如将十进制纬度/经度坐标转换为iPad屏幕坐标 。 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.
但除非你给出一个你想要转换坐标的坐标系,否则你的问题没有意义。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.