测地线

用于在地球椭球模型上解决测地线问题的 CLLocationCoordinate2D 扩展。

let lax = CLLocationCoordinate2D(latitude: 33.9424964, longitude: -118.4080486)
let jfk = CLLocationCoordinate2D(latitude: 40.6399278, longitude: -73.7786925)
let distance = lax.distanceTo(jfk)
// distance is approx. 3,982,961 m

安装

Swift 包管理器

在 Xcode 中添加对 https://github.com/sbooth/Geodesic 的包依赖。

手动或自定义构建

  1. 克隆 Geodesic 仓库。
  2. swift build.

许可协议

Geodesic 基于 MIT 许可证 发布。