gpt4 book ai didi

iphone - 将 CLLocation 或 CLLocationCoordinate2D 转换为 CGPoint

转载 作者:可可西里 更新时间:2023-11-01 03:29:38 25 4
gpt4 key购买 nike

如何将 CLLocationCLLocationCoordinate2D 转换为 CGPoint。我见过

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

但在我的例子中我不需要使用 mapView。我尝试使用谷歌搜索,但没有找到任何有用的信息。

编辑:我需要将地理坐标转换为 iPad 的屏幕坐标,如 Convert decimal latitude/longitude coordinates to iPad screen coordinates 所示。 .我正在尝试根据转换后的坐标值绘制线/路径。

有直接的方法吗,还是我需要写一个算法来做同样的事情。

最佳答案

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

请注意,坐标轴已交换。但是,除非您提供一个您希望将坐标转换到的坐标系,否则您的问题就没有意义。

关于iphone - 将 CLLocation 或 CLLocationCoordinate2D 转换为 CGPoint,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17234430/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com