ios - 计算 iOS map 上两点之间的距离

标签 ios swift google-maps google-maps-api-3 apple-maps

<分区>

是否可以使用 Apple map 框架或 Google 框架计算 iOS 上 2 个接近点之间的距离? 例如,我想以尽可能高的精度获取这 2 个蓝点之间的距离。

enter image description here

使用谷歌地图或苹果 map 我可以得到很多数字的2坐标吗?我如何计算以厘米或毫米为单位的距离?

最佳答案

试试这个-

let coordinate0 = CLLocation(latitude: 5.0, longitude: 5.0)
let coordinate1 = CLLocation(latitude: 5.0, longitude: 3.0)
let distanceInMeters = coordinate0.distance(from: coordinate1)

关于ios - 计算 iOS map 上两点之间的距离,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45533739/

相关文章:

swift - 使用委托(delegate)时没有任何反应

google-maps - 谷歌地图 API : how to disable commercial locations?

ios - NSKeyedUnarchiver 未返回 "nil"

iphone - 更新时现有 iOS 应用程序会发生什么情况?

objective-c - 如何绘制 UILabel 边框

javascript - 在 Google map 中创建自定义信息窗口

android - 在位置更改时将标记动画化到当前位置

ios - 应用程序进入前台速度缓慢

swift - 将 UISwitch 状态获取到位于 indexPath 的 UIcollectionView 中

ios - Swift - 解析结果现在总是空的但以前不是?仍然可以发布对象但不能通过查询获取?