iOS 和 Android 上的 GPS 定位

人气:1,053 发布:2022-09-11 标签: android ios gps coordinates

问题描述

我对 Android 应用程序的编程经验有限,对 iOS 完全没有.我未来项目的一部分是让我的应用程序能够在 Android 和 iOS 上使用 GPS 记录当前位置.

I have limited experience programming Android apps and none at all for iOS. Part of a future project of mine is to make my app be able to record the current location using GPS possibly on both Android and iOS.

是否可以像在 Google 地球中一样为两个平台以通用横轴墨卡托"格式获取 GPS 坐标?如果没有,有没有办法将坐标计算为这种格式?

Can the GPS coordinates be taken in "Universal Transverse Mercator" format like in Google Earth for both platforms? If not, is there some way to calculate the coordinates to this format?

有没有人知道他们各自 API 中的函数返回什么格式?

Any chance anyone would know what format the functions in their respective APIs return?

推荐答案

API 将提供一个位置对象(Android 的 Location 类和 iOS 的 CLLocation 类).两个 API 都有纬度和经度的 getter,它们是 floats.纬度和经度是 WGS84 参考椭球的 GPS 坐标.

The API will provide a location object (class Location for Android and CLLocation for iOS). Both API have getters for latitude and longitude, which are floats. Latitude and longitude are the GPS coordinates wrt to the WGS84 reference elipsoid.

如果您需要将这些转换为其他坐标系,则网络中应该有很多参考.

If you need to transform these into some other coordinate system there should be lots of references in the web.

449