commit
a7c50973f0
|
@ -16,7 +16,7 @@ Convert between latitude/longitude and the [UTM (Universal Transverse Mercator)]
|
|||
To integrate UTMConversion into your Xcode project using [Carthage](https://github.com/Carthage/Carthage), specify it in your `Cartfile`:
|
||||
|
||||
```ogdl
|
||||
github "wtw-software/UTMConversion" ~> 1.0
|
||||
github "peterringset/UTMConversion" ~> 1.1
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
|
|
@ -77,6 +77,7 @@
|
|||
454361F31E7C0A4900656472 /* UTMCoordinate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UTMCoordinate.swift; sourceTree = "<group>"; };
|
||||
454361F81E7C0A7B00656472 /* CLLocationCoordinate2D+UTMCoordinate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "CLLocationCoordinate2D+UTMCoordinate.swift"; sourceTree = "<group>"; };
|
||||
454362041E7C0E0400656472 /* CLLocation+UTMCoordinate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "CLLocation+UTMCoordinate.swift"; sourceTree = "<group>"; };
|
||||
45F3273B1F54102500961639 /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
|
@ -138,6 +139,7 @@
|
|||
454361691E7BE75800656472 = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
45F3273B1F54102500961639 /* README.md */,
|
||||
454361751E7BE75800656472 /* UTMConversion */,
|
||||
454361801E7BE75800656472 /* UTMConversionTests */,
|
||||
454361741E7BE75800656472 /* Products */,
|
||||
|
@ -353,46 +355,49 @@
|
|||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastSwiftUpdateCheck = 0820;
|
||||
LastUpgradeCheck = 0820;
|
||||
LastUpgradeCheck = 0900;
|
||||
ORGANIZATIONNAME = "Peter Ringset";
|
||||
TargetAttributes = {
|
||||
454361721E7BE75800656472 = {
|
||||
CreatedOnToolsVersion = 8.2.1;
|
||||
DevelopmentTeam = W79FWJ7E3Y;
|
||||
LastSwiftMigration = 0820;
|
||||
LastSwiftMigration = 0900;
|
||||
ProvisioningStyle = Automatic;
|
||||
};
|
||||
4543617B1E7BE75800656472 = {
|
||||
CreatedOnToolsVersion = 8.2.1;
|
||||
DevelopmentTeam = 7L5H8T8QE3;
|
||||
LastSwiftMigration = 0900;
|
||||
ProvisioningStyle = Automatic;
|
||||
};
|
||||
454361911E7BE77F00656472 = {
|
||||
CreatedOnToolsVersion = 8.2.1;
|
||||
DevelopmentTeam = W79FWJ7E3Y;
|
||||
LastSwiftMigration = 0820;
|
||||
LastSwiftMigration = 0900;
|
||||
ProvisioningStyle = Automatic;
|
||||
};
|
||||
454361991E7BE78000656472 = {
|
||||
CreatedOnToolsVersion = 8.2.1;
|
||||
DevelopmentTeam = W79FWJ7E3Y;
|
||||
LastSwiftMigration = 0900;
|
||||
ProvisioningStyle = Automatic;
|
||||
};
|
||||
454361AD1E7BE79F00656472 = {
|
||||
CreatedOnToolsVersion = 8.2.1;
|
||||
DevelopmentTeam = W79FWJ7E3Y;
|
||||
LastSwiftMigration = 0820;
|
||||
LastSwiftMigration = 0900;
|
||||
ProvisioningStyle = Automatic;
|
||||
};
|
||||
454361B51E7BE7A000656472 = {
|
||||
CreatedOnToolsVersion = 8.2.1;
|
||||
DevelopmentTeam = W79FWJ7E3Y;
|
||||
LastSwiftMigration = 0900;
|
||||
ProvisioningStyle = Automatic;
|
||||
};
|
||||
454361C91E7BE7B000656472 = {
|
||||
CreatedOnToolsVersion = 8.2.1;
|
||||
DevelopmentTeam = W79FWJ7E3Y;
|
||||
LastSwiftMigration = 0820;
|
||||
LastSwiftMigration = 0900;
|
||||
ProvisioningStyle = Automatic;
|
||||
};
|
||||
};
|
||||
|
@ -571,7 +576,9 @@
|
|||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
|
@ -579,7 +586,11 @@
|
|||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
|
@ -625,7 +636,9 @@
|
|||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
|
@ -633,7 +646,11 @@
|
|||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
|
@ -680,7 +697,7 @@
|
|||
PRODUCT_NAME = UTMConversion;
|
||||
SKIP_INSTALL = YES;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
SWIFT_VERSION = 3.0;
|
||||
SWIFT_VERSION = 4.0;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
|
@ -700,7 +717,7 @@
|
|||
PRODUCT_BUNDLE_IDENTIFIER = no.ringset.UTMConversion;
|
||||
PRODUCT_NAME = UTMConversion;
|
||||
SKIP_INSTALL = YES;
|
||||
SWIFT_VERSION = 3.0;
|
||||
SWIFT_VERSION = 4.0;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
|
@ -713,7 +730,7 @@
|
|||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = no.ringset.UTMConversionTests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_VERSION = 3.0;
|
||||
SWIFT_VERSION = 4.0;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
|
@ -726,7 +743,7 @@
|
|||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = no.ringset.UTMConversionTests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_VERSION = 3.0;
|
||||
SWIFT_VERSION = 4.0;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
|
@ -748,7 +765,7 @@
|
|||
SDKROOT = appletvos;
|
||||
SKIP_INSTALL = YES;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
SWIFT_VERSION = 3.0;
|
||||
SWIFT_VERSION = 4.0;
|
||||
TARGETED_DEVICE_FAMILY = 3;
|
||||
TVOS_DEPLOYMENT_TARGET = 10.1;
|
||||
};
|
||||
|
@ -771,7 +788,7 @@
|
|||
PRODUCT_NAME = UTMConversion;
|
||||
SDKROOT = appletvos;
|
||||
SKIP_INSTALL = YES;
|
||||
SWIFT_VERSION = 3.0;
|
||||
SWIFT_VERSION = 4.0;
|
||||
TARGETED_DEVICE_FAMILY = 3;
|
||||
TVOS_DEPLOYMENT_TARGET = 10.1;
|
||||
};
|
||||
|
@ -787,7 +804,7 @@
|
|||
PRODUCT_BUNDLE_IDENTIFIER = "no.ringset.UTMConversion-tvOSTests";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SDKROOT = appletvos;
|
||||
SWIFT_VERSION = 3.0;
|
||||
SWIFT_VERSION = 4.0;
|
||||
TVOS_DEPLOYMENT_TARGET = 10.1;
|
||||
};
|
||||
name = Debug;
|
||||
|
@ -802,7 +819,7 @@
|
|||
PRODUCT_BUNDLE_IDENTIFIER = "no.ringset.UTMConversion-tvOSTests";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SDKROOT = appletvos;
|
||||
SWIFT_VERSION = 3.0;
|
||||
SWIFT_VERSION = 4.0;
|
||||
TVOS_DEPLOYMENT_TARGET = 10.1;
|
||||
};
|
||||
name = Release;
|
||||
|
@ -828,7 +845,7 @@
|
|||
SDKROOT = macosx;
|
||||
SKIP_INSTALL = YES;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
SWIFT_VERSION = 3.0;
|
||||
SWIFT_VERSION = 4.0;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
|
@ -852,7 +869,7 @@
|
|||
PRODUCT_NAME = UTMConversion;
|
||||
SDKROOT = macosx;
|
||||
SKIP_INSTALL = YES;
|
||||
SWIFT_VERSION = 3.0;
|
||||
SWIFT_VERSION = 4.0;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
|
@ -869,7 +886,7 @@
|
|||
PRODUCT_BUNDLE_IDENTIFIER = "no.ringset.UTMConversion-macOSTests";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SDKROOT = macosx;
|
||||
SWIFT_VERSION = 3.0;
|
||||
SWIFT_VERSION = 4.0;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
|
@ -886,7 +903,7 @@
|
|||
PRODUCT_BUNDLE_IDENTIFIER = "no.ringset.UTMConversion-macOSTests";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SDKROOT = macosx;
|
||||
SWIFT_VERSION = 3.0;
|
||||
SWIFT_VERSION = 4.0;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
|
@ -909,7 +926,7 @@
|
|||
SDKROOT = watchos;
|
||||
SKIP_INSTALL = YES;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
SWIFT_VERSION = 3.0;
|
||||
SWIFT_VERSION = 4.0;
|
||||
TARGETED_DEVICE_FAMILY = 4;
|
||||
WATCHOS_DEPLOYMENT_TARGET = 3.1;
|
||||
};
|
||||
|
@ -933,7 +950,7 @@
|
|||
PRODUCT_NAME = UTMConversion;
|
||||
SDKROOT = watchos;
|
||||
SKIP_INSTALL = YES;
|
||||
SWIFT_VERSION = 3.0;
|
||||
SWIFT_VERSION = 4.0;
|
||||
TARGETED_DEVICE_FAMILY = 4;
|
||||
WATCHOS_DEPLOYMENT_TARGET = 3.1;
|
||||
};
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0820"
|
||||
LastUpgradeVersion = "0900"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
|
@ -26,6 +26,7 @@
|
|||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
language = ""
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
codeCoverageEnabled = "YES">
|
||||
<Testables>
|
||||
|
@ -56,6 +57,7 @@
|
|||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
language = ""
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0820"
|
||||
LastUpgradeVersion = "0900"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
|
@ -26,6 +26,7 @@
|
|||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
language = ""
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
codeCoverageEnabled = "YES">
|
||||
<Testables>
|
||||
|
@ -56,6 +57,7 @@
|
|||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
language = ""
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0820"
|
||||
LastUpgradeVersion = "0900"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
|
@ -26,6 +26,7 @@
|
|||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
language = ""
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
codeCoverageEnabled = "YES">
|
||||
<Testables>
|
||||
|
@ -56,6 +57,7 @@
|
|||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
language = ""
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0820"
|
||||
LastUpgradeVersion = "0900"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
|
@ -26,6 +26,7 @@
|
|||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
language = ""
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
codeCoverageEnabled = "YES">
|
||||
<Testables>
|
||||
|
@ -37,6 +38,7 @@
|
|||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
language = ""
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
|
|
|
@ -30,11 +30,11 @@ import Foundation
|
|||
let utmScaleFactor = 0.9996
|
||||
|
||||
func toDegrees(radians: Double) -> Double {
|
||||
return radians * 180 / M_PI
|
||||
return radians * 180 / Double.pi
|
||||
}
|
||||
|
||||
func toRadians(degrees: Double) -> Double {
|
||||
return degrees / 180 * M_PI
|
||||
return degrees / 180 * Double.pi
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -14,42 +14,54 @@ class UTMConversionTests: XCTestCase {
|
|||
|
||||
func testCLLocationCoordinate2D_utmCoordinate() {
|
||||
let osloUTM = oslo.utmCoordinate()
|
||||
XCTAssertEqualWithAccuracy(osloUTM.northing, 6643010.0, accuracy: 0.00001);
|
||||
XCTAssertEqualWithAccuracy(osloUTM.easting, 598430.0, accuracy: 0.00001);
|
||||
XCTAssertEqual(osloUTM.northing, 6643010.0, accuracy: 0.00001);
|
||||
XCTAssertEqual(osloUTM.easting, 598430.0, accuracy: 0.00001);
|
||||
XCTAssertEqual(osloUTM.zone, 32)
|
||||
XCTAssertEqual(osloUTM.hemisphere, .northern)
|
||||
|
||||
let trondheimUTM = trondheim.utmCoordinate()
|
||||
XCTAssertEqualWithAccuracy(trondheimUTM.northing, 7034313, accuracy: 0.00001)
|
||||
XCTAssertEqualWithAccuracy(trondheimUTM.easting, 569612, accuracy: 0.00001)
|
||||
XCTAssertEqual(trondheimUTM.northing, 7034313, accuracy: 0.00001)
|
||||
XCTAssertEqual(trondheimUTM.easting, 569612, accuracy: 0.00001)
|
||||
XCTAssertEqual(trondheimUTM.zone, 32)
|
||||
XCTAssertEqual(trondheimUTM.hemisphere, .northern)
|
||||
|
||||
let johannesburgUTM = johannesburg.utmCoordinate()
|
||||
XCTAssertEqualWithAccuracy(johannesburgUTM.northing, 7100115, accuracy: 0.00001)
|
||||
XCTAssertEqualWithAccuracy(johannesburgUTM.easting, 603914, accuracy: 0.00001)
|
||||
XCTAssertEqual(johannesburgUTM.northing, 7100115, accuracy: 0.00001)
|
||||
XCTAssertEqual(johannesburgUTM.easting, 603914, accuracy: 0.00001)
|
||||
XCTAssertEqual(johannesburgUTM.zone, 35)
|
||||
XCTAssertEqual(johannesburgUTM.hemisphere, .southern)
|
||||
|
||||
let buninyongUTM = buninyong.utmCoordinate()
|
||||
XCTAssertEqual(buninyongUTM.northing, 5828674.33994, accuracy: 0.00001)
|
||||
XCTAssertEqual(buninyongUTM.easting, 758173.79835, accuracy: 0.00001)
|
||||
XCTAssertEqual(buninyongUTM.zone, 54)
|
||||
XCTAssertEqual(buninyongUTM.hemisphere, .southern)
|
||||
}
|
||||
|
||||
func testCLLocation_utmCoordinate() {
|
||||
let osloUTM = osloLocation.utmCoordinate()
|
||||
XCTAssertEqualWithAccuracy(osloUTM.northing, 6643010.0, accuracy: 0.00001);
|
||||
XCTAssertEqualWithAccuracy(osloUTM.easting, 598430.0, accuracy: 0.00001);
|
||||
XCTAssertEqual(osloUTM.northing, 6643010.0, accuracy: 0.00001);
|
||||
XCTAssertEqual(osloUTM.easting, 598430.0, accuracy: 0.00001);
|
||||
XCTAssertEqual(osloUTM.zone, 32)
|
||||
XCTAssertEqual(osloUTM.hemisphere, .northern)
|
||||
|
||||
let trondheimUTM = trondheimLocation.utmCoordinate()
|
||||
XCTAssertEqualWithAccuracy(trondheimUTM.northing, 7034313, accuracy: 0.00001)
|
||||
XCTAssertEqualWithAccuracy(trondheimUTM.easting, 569612, accuracy: 0.00001)
|
||||
XCTAssertEqual(trondheimUTM.northing, 7034313, accuracy: 0.00001)
|
||||
XCTAssertEqual(trondheimUTM.easting, 569612, accuracy: 0.00001)
|
||||
XCTAssertEqual(trondheimUTM.zone, 32)
|
||||
XCTAssertEqual(trondheimUTM.hemisphere, .northern)
|
||||
|
||||
let johannesburgUTM = johannesburgLocation.utmCoordinate()
|
||||
XCTAssertEqualWithAccuracy(johannesburgUTM.northing, 7100115, accuracy: 0.00001)
|
||||
XCTAssertEqualWithAccuracy(johannesburgUTM.easting, 603914, accuracy: 0.00001)
|
||||
XCTAssertEqual(johannesburgUTM.northing, 7100115, accuracy: 0.00001)
|
||||
XCTAssertEqual(johannesburgUTM.easting, 603914, accuracy: 0.00001)
|
||||
XCTAssertEqual(johannesburgUTM.zone, 35)
|
||||
XCTAssertEqual(johannesburgUTM.hemisphere, .southern)
|
||||
|
||||
let buninyongUTM = buninyongLocation.utmCoordinate()
|
||||
XCTAssertEqual(buninyongUTM.northing, 5828674.33994, accuracy: 0.00001)
|
||||
XCTAssertEqual(buninyongUTM.easting, 758173.79835, accuracy: 0.00001)
|
||||
XCTAssertEqual(buninyongUTM.zone, 54)
|
||||
XCTAssertEqual(buninyongUTM.hemisphere, .southern)
|
||||
}
|
||||
|
||||
func testUTMCoordinate_coordinate() {
|
||||
|
@ -65,6 +77,10 @@ class UTMConversionTests: XCTestCase {
|
|||
let johannesburg = utmJohannesburg.coordinate()
|
||||
XCTAssertEqual(johannesburg.latitude, -26.214767103043133)
|
||||
XCTAssertEqual(johannesburg.longitude, 28.040197220939884)
|
||||
|
||||
let buninyong = buninyongUTM.coordinate()
|
||||
XCTAssertEqual(buninyong.latitude, -37.65282114, accuracy: 0.00001)
|
||||
XCTAssertEqual(buninyong.longitude, 143.92649554, accuracy: 0.00001)
|
||||
}
|
||||
|
||||
func testUTMCoordinate_location() {
|
||||
|
@ -79,19 +95,26 @@ class UTMConversionTests: XCTestCase {
|
|||
let johannesburg = johannesburgUTM.location()
|
||||
XCTAssertEqual(johannesburg.coordinate.latitude, -26.214767103043133)
|
||||
XCTAssertEqual(johannesburg.coordinate.longitude, 28.040197220939884)
|
||||
|
||||
let buninyong = buninyongUTM.location()
|
||||
XCTAssertEqual(buninyong.coordinate.latitude, -37.65282114, accuracy: 0.00001)
|
||||
XCTAssertEqual(buninyong.coordinate.longitude, 143.92649554, accuracy: 0.00001)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
private let buninyong = CLLocationCoordinate2D(latitude: -37.65282114, longitude: 143.92649554)
|
||||
private let oslo = CLLocationCoordinate2D(latitude: 59.912814611065265, longitude: 10.760192985178369)
|
||||
private let trondheim = CLLocationCoordinate2D(latitude: 63.430493678423012, longitude: 10.394966844991798)
|
||||
private let johannesburg = CLLocationCoordinate2D(latitude: -26.214767103043133, longitude: 28.040197220939884)
|
||||
|
||||
private let buninyongUTM = UTMCoordinate(northing: 5828674.33994, easting: 758173.79835, zone: 54, hemisphere: .southern)
|
||||
private let osloUTM = UTMCoordinate(northing: 6643010, easting: 598430, zone: 32, hemisphere: .northern)
|
||||
private let trondheimUTM = UTMCoordinate(northing: 7034313, easting: 569612, zone: 32, hemisphere: .northern)
|
||||
private let johannesburgUTM = UTMCoordinate(northing: 7100115, easting: 603914, zone: 35, hemisphere: .southern)
|
||||
|
||||
private let buninyongLocation = CLLocation(latitude: buninyong.latitude, longitude: buninyong.longitude)
|
||||
private let osloLocation = CLLocation(latitude: 59.912814611065265, longitude: 10.760192985178369)
|
||||
private let trondheimLocation = CLLocation(latitude: 63.430493678423012, longitude: 10.394966844991798)
|
||||
private let johannesburgLocation = CLLocation(latitude: -26.214767103043133, longitude: 28.040197220939884)
|
||||
|
|
Loading…
Reference in New Issue