Go to file
Peter Ringset 53172a2f32 Bump version number to 1.4 2021-03-02 11:37:23 +01:00
.swiftpm/xcode/package.xcworkspace Remove watchOS and tvOS targets, update to recommended project settings 2021-03-02 11:20:36 +01:00
UTMConversion Remove auto-generated comments in files 2021-03-02 11:27:51 +01:00
UTMConversion.xcodeproj Bump version number to 1.4 2021-03-02 11:37:23 +01:00
UTMConversionTests Remove auto-generated comments in files 2021-03-02 11:27:51 +01:00
.gitignore Initial commit 2017-03-17 12:52:33 +01:00
LICENSE Initial commit 2017-03-17 12:52:33 +01:00
Package.swift Update package file with iOS 12, remove watchOS and tvOS support 2021-03-02 11:22:25 +01:00
README.md Bump version number to 1.4 2021-03-02 11:37:23 +01:00
UTMConversion.podspec Bump version number to 1.4 2021-03-02 11:37:23 +01: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 12.0+ / macOS 10.10+

Installation

Carthage

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

github "wtw-software/UTMConversion" ~> 1.4

CocoaPods

To integrate UTMConversion into you Xcode project using CocoaPods, specify it in you Podfile:

target 'MyApp' do
  pod 'UTMConversion', '~> 1.4'
end

Then run pod install inside your terminal, or from CocoaPods.app.

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)