我的应用通过使用以下代码获取longitude
和latitude
,将位置坐标发送到服务器。
func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation])
{
let locationArray = locations as NSArray
let locationObj = locationArray.lastObject as! CLLocation
let coord = locationObj.coordinate
latitudeTxt = String(format: "%.4f", coord.latitude)
longitudeTxt = String(format: "%.4f",coord.longitude)
}
我现在被要求将这些值作为网格参考发送,而我发现这样做的唯一方法就是使用非常复杂的算法。
有没有更简单的方法从我的经度和纬度值中获取网格参考?
答案 0 :(得分:0)
没有原生支持,但我确实在github上找到了这个项目:GeodeticUTMConverter。它似乎实现了用于将lat / long转换为easting& amp;北方,你可能需要做一些工作来获得精确的网格参考,但它是一个很好的起点。