Go to file
peterringset a7c50973f0 Merge pull request #4 from wtw-software/develop
Develop
2017-09-14 16:04:31 +02:00
UTMConversion Merge branch 'master' into develop 2017-09-14 16:04:02 +02:00
UTMConversion.xcodeproj Include README in project file 2017-08-28 10:48:49 +02:00
UTMConversionTests Added more testing 2017-08-28 10:47:06 +02:00
.gitignore Initial commit 2017-03-17 12:52:33 +01:00
LICENSE Initial commit 2017-03-17 12:52:33 +01:00
README.md Updated README 2017-09-14 16:01:43 +02:00

README.md

UTMConversion

Carthage compatible MIT Licence

Convert between latitude/longitude and the UTM (Universal Transverse Mercator) coordinate systems. The conversion happens between a custom struct UTMCoordinate and CoreLocation's CLLocationCoordinate2D and CLLocation.

Requirements

  • iOS 8.0+ / macOS 10.10+ / tvOS 9.0+ / watchOS 2.0+
  • Xcode 8.1+
  • Swift 3.0+

Installation

Carthage

To integrate UTMConversion into your Xcode project using Carthage, specify it in your Cartfile:

github "peterringset/UTMConversion" ~> 1.1

Usage

Convert to UTM

import CoreLocation
import UTMConversion

let coordinate = CLLocationCoordinate2D(latitude: 63.430493678423012, longitude: 10.394966844991798)
let utmCoordinate = coordinate.utmCoordinate()

let location = CLLocation(latitude: 63.430493678423012, longitude: 10.394966844991798)
let utmCoordinate2 = location.utmCoordinate()

Convert from UTM

import CoreLocation
import UTMConversion

let utmCoordinate = UTMCoordinate(northing: 7034313, easting: 569612, zone: 32, hemisphere: .northern)
let coordinate = utmCoordinate.coordinate()
let location = utmCoordinate.location()

Datum

It is possible to specify your own datum (polar and equitorial radius), the default value is WGS84, which is the latest revision of the WGS standard.

import CoreLocation
import UTMConversion

let utmCoordinate = UTMCoordinate(northing: 7034313, easting: 569612, zone: 32, hemisphere: .northern)
let datum = UTMDatum(equitorialRadius: 6378137, polarRadius: 6356752.3142)
let coordinate = utmCoordinate.coordinate(datum: datum)