0

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. What do I need to know before even trying to write a function on my own?

Example:

Lat: 56.545414, Lon: 13.469853

Should return:

N 6269294, E 148146

A Swift func would be really appreciated! Thanks for your help.

nilsd
  • 23
  • 5

1 Answers1

0

There is no easy way.
You need a coordinate transformation library. That libs are written in C, which you can import in ios. How to call a C function from Swift is explained here: How to call C from Swift?

In that library you pass in the coordinate system definition string found at 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. Sweref is a special variant of the UTM conversion, with only changed input paramters. (which you found at the link above) This solution is probably the fastest to get running.

Community
  • 1
  • 1
AlexWien
  • 28,470
  • 6
  • 53
  • 83