Class
MGRS
public class MGRS: Hashable
- Military Grid Reference System Coordinate
Relationships
Conforms To
Hashable
Initializers
init(_:_:_:_:_:_:)
public init(_ zone: Int, _ band: Character, _ column: Character, _ row: Character, _ easting: Int, _ northing: Int)
- Initialize
- @param zone
-
zone number
- @param band
-
band letter
- @param column
-
column letter
- @param row
-
row letter
- @param easting
-
easting
- @param northing
-
northing
init(_:_:_:_:)
public convenience init(_ zone: Int, _ band: Character, _ easting: Int, _ northing: Int)
- Initialize
- @param zone
-
zone number
- @param band
-
band letter
- @param column
-
column letter
- @param row
-
row letter
- @param easting
-
easting
- @param northing
-
northing
Properties
description
public var description: String
Methods
coordinate()
public func coordinate() -> String
- Get the MGRS coordinate with one meter precision
- @return MGRS coordinate
coordinate(_:)
public func coordinate(_ type: GridType?) -> String
- Get the MGRS coordinate with specified grid precision
- @param type
-
grid type precision
- @return MGRS coordinate
eastingAndNorthing(_:)
public func eastingAndNorthing(_ type: GridType) -> String
- Get the easting and northing concatenated value in the grid type
- precision
- @param type
-
grid type precision
- @return easting and northing value
coordinate(_:)
public func coordinate(_ accuracy: Int) -> String
- Get the MGRS coordinate with the accuracy number of digits in the easting
- and northing values. Accuracy must be inclusively between 0
- (GridType.HUNDRED_KILOMETER) and 5 (GridType.METER).
- @param accuracy
-
accuracy digits between 0 (inclusive) and 5 (inclusive)
- @return MGRS coordinate
precision()
public func precision() -> GridType
- Get the MGRS coordinate grid precision
- @return grid type precision
accuracy()
public func accuracy() -> Int
- Get the MGRS coordinate accuracy number of digits
- @return accuracy digits
columnRowId()
public func columnRowId() -> String
- Get the two letter column and row 100k designator
- @return the two letter column and row 100k designator
toCoordinate()
public func toCoordinate() -> CLLocationCoordinate2D
- Convert to a location coordinate
- @return coordinate
hash(into:)
public func hash(into hasher: inout Hasher)
isMGRS(_:)
public static func isMGRS(_ mgrs: String) -> Bool
- Return whether the given string is valid MGRS string
- @param mgrs
-
potential MGRS string
- @return true if MGRS string is valid, false otherwise
from(_:)
- Encodes a point as a MGRS
- @param point
-
point
- @return MGRS
from(_:)
public static func from(_ coordinate: CLLocationCoordinate2D) -> MGRS
- Encodes a coordinate as a MGRS
- @param coordinate
-
coordinate
- @return MGRS
from(_:_:)
public static func from(_ longitude: Double, _ latitude: Double) -> MGRS
- Encodes a coordinate in degrees as a MGRS
- @param longitude
-
longitude
- @param latitude
-
latitude
- @return MGRS
from(_:_:_:)
- Encodes a coordinate in the unit as a MGRS
- @param longitude
-
longitude
- @param latitude
-
latitude
- @param unit
-
unit
- @return MGRS
parse(_:)
public static func parse(_ mgrs: String) -> MGRS
- Parse a MGRS string
- @param mgrs
-
MGRS string
- @return MGRS
parseToCoordinate(_:)
public static func parseToCoordinate(_ mgrs: String) -> CLLocationCoordinate2D
- Parse a MGRS string into a location coordinate
- @param mgrs
-
MGRS string
- @return coordinate
coordinate(_:)
public static func coordinate(_ point: GridPoint) -> String
- Encodes a point as a MGRS coordinate with one meter precision
- @param point
-
point
- @return MGRS coordinate
coordinate(_:_:)
- Encodes a point as a MGRS coordinate with specified grid precision
- @param point
-
point
- @param type
-
grid type precision
- @return MGRS coordinate
coordinate(_:)
public static func coordinate(_ coordinate: CLLocationCoordinate2D) -> String
- Encodes a coordinate as a MGRS coordinate with one meter precision
- @param coordinate
-
coordinate
- @return MGRS coordinate
coordinate(_:_:)
public static func coordinate(_ coordinate: CLLocationCoordinate2D, _ type: GridType?) -> String
- Encodes a coordinate as a MGRS coordinate with specified grid precision
- @param coordinate
-
coordinate
- @param type
-
grid type precision
- @return MGRS coordinate
coordinate(_:_:)
public static func coordinate(_ longitude: Double, _ latitude: Double) -> String
- Encodes a coordinate in degrees as a MGRS coordinate with one meter precision
- @param longitude
-
longitude
- @param latitude
-
latitude
- @return MGRS coordinate
coordinate(_:_:_:)
public static func coordinate(_ longitude: Double, _ latitude: Double, _ type: GridType?) -> String
- Encodes a coordinate in degrees as a MGRS coordinate with specified grid precision
- @param longitude
-
longitude
- @param latitude
-
latitude
- @param type
-
grid type precision
- @return MGRS coordinate
coordinate(_:_:_:)
public static func coordinate(_ longitude: Double, _ latitude: Double, _ unit: grid_ios.Unit) -> String
- Encodes a coordinate in the unit as a MGRS coordinate with one meter precision
- @param longitude
-
longitude
- @param latitude
-
latitude
- @param unit
-
unit
- @return MGRS coordinate
coordinate(_:_:_:_:)
public static func coordinate(_ longitude: Double, _ latitude: Double, _ unit: grid_ios.Unit, _ type: GridType?) -> String
- Encodes a coordinate in the unit as a MGRS coordinate with specified grid precision
- @param longitude
-
longitude
- @param latitude
-
latitude
- @param unit
-
unit
- @param type
-
grid type precision
- @return MGRS coordinate
precision(_:)
public static func precision(_ mgrs: String) -> GridType
- Parse the MGRS string for the precision
- @param mgrs
-
MGRS string
- @return grid type precision
accuracy(_:)
public static func accuracy(_ mgrs: String) -> Int
- Get the MGRS coordinate accuracy number of digits
- @param mgrs
-
MGRS string
- @return accuracy digits
columnRowId(_:_:_:)
public static func columnRowId(_ easting: Double, _ northing: Double, _ zoneNumber: Int) -> String
- Get the two letter column and row 100k designator for a given UTM
- easting, northing and zone number value
- @param easting
-
easting
- @param northing
-
northing
- @param zoneNumber
-
zone number
- @return the two letter column and row 100k designator
columnLetter(_:)
public static func columnLetter(_ utm: UTM) -> Character
- Get the column letter from the UTM
- @param utm
-
UTM
- @return column letter
columnLetter(_:_:)
public static func columnLetter(_ zoneNumber: Int, _ easting: Double) -> Character
- Get the column letter from the zone number and easting
- @param zoneNumber
-
zone number
- @param easting
-
easting
- @return column letter
rowLetter(_:)
public static func rowLetter(_ utm: UTM) -> Character
- Get the row letter from the UTM
- @param utm
-
UTM
- @return row letter
rowLetter(_:_:)
public static func rowLetter(_ zoneNumber: Int, _ northing: Double) -> Character
- Get the row letter from the zone number and northing
- @param zoneNumber
-
zone number
- @param northing
-
northing
- @return row letter