ios - 在 iOS 中获取谷歌地图的中心

标签 ios iphone google-maps google-maps-api-3 google-maps-markers

我在我的应用程序中添加了一个谷歌地图。它显示了从源到目的地的路径。

我还想显示估计的时间,该路径的长度如下:

Estimated Time

如何使用谷歌地图计算路径中心?

感谢您抽出宝贵时间!

提前致谢...

最佳答案

试试这个...

让 coordinateA = CLLocation(latitude: 55.0, longitude: 35.0)

设坐标B = CLLocation(纬度: 65.0, 经度: 73.0)

让 distanceInMeters = coordinateA.distance(from: coordinateB)

计算距离后,使用此公式计算速度。

即速度=距离/时间

试试这个委托(delegate)来获得速度或时间

func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation])

关于ios - 在 iOS 中获取谷歌地图的中心,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44899665/

相关文章:

javascript - 如何切换标记?

ios - 将 ISO6801 日期转换为 NSDate 以进行 RestKit 对象映射

ios - 具有许多图像的 UITableView 内存使用率高

iphone - 我现在需要使用 CMUSphinx 的 iPhone 语音库 OpenEars 的准确性?

ios - 在应用移至后台后检测输入和输出

android - 在 Google map v2 Android 上添加标记

javascript - Google map 地理编码回调参数错误

ios - 有没有办法在 M1 MacBook 上直接运行 iOS 二进制文件?

ios - 当我在模型中使用withAnimation时,没有动画发生,为什么?

ios - 苹果商店和 Iframe 应用程序