简体   繁体   English

从坐标系WGS84转换为SWEREF991330

[英]Converting from coordinate system WGS84 to SWEREF991330

I've been looking for a way to convert GPS coordinates in my iOS app (written in Swift) to SWEREF99 (1330 in my case) but it seems impossible to find an "easy" way of doing this. 我一直在寻找将iOS应用程序(用Swift编写)中的GPS坐标转换为SWEREF99(在我的情况下为1330)的方法,但是似乎找不到一种“简便”的方法。 What do I need to know before even trying to write a function on my own? 在尝试自己编写函数之前,我需要了解什么?

Example: 例:

Lat: 56.545414, Lon: 13.469853 经度:56.545414,经度:13.469853

Should return: 应该返回:

N 6269294, E 148146 N 6269294,E 148146

A Swift func would be really appreciated! Swift函子将不胜感激! Thanks for your help. 谢谢你的帮助。

There is no easy way. 没有简单的方法。
You need a coordinate transformation library. 您需要一个坐标转换库。 That libs are written in C, which you can import in ios. 这些库是用C编写的,您可以在ios中将其导入。 How to call a C function from Swift is explained here: How to call C from Swift? 下面说明了如何从Swift调用C函数: 如何从Swift调用C?

In that library you pass in the coordinate system definition string found at http://spatialreference.org/ref/epsg/sweref99-13-30/ 在该库中,您输入http://spatialreference.org/ref/epsg/sweref99-13-30/中找到的坐标系定义字符串

If for some reasons you want to implement that on your own, you have to read how a transversal mercator projection works. 如果出于某些原因要自己实现,则必须阅读横向墨卡托投影的工作原理。 Further you need some know how coordinate system transformations. 此外,您还需要了解如何协调系统转换。 There is WGS84 to UTM code available. 有可用的WGS84到UTM代码。 Sweref is a special variant of the UTM conversion, with only changed input paramters. Sweref是UTM转换的特殊变体,仅更改了输入参数。 (which you found at the link above) This solution is probably the fastest to get running. (您可以在上面的链接中找到)该解决方案可能是最快运行的解决方案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM