mgrs-ios 1.1.6 Documentation

Class MGRS

public class MGRS: Hashable  
  • Military Grid Reference System Coordinate
MGRS MGRS Hashable Hashable MGRS->Hashable

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

zone

public let zone: Int
  • Zone number

band

public let band: Character
  • Band letter

column

public let column: Character
  • Column letter

row

public let row: Character
  • Row letter

easting

public let easting: Int
  • Easting

northing

public let northing: Int
  • Northing

description

public var description: String  

Methods

hemisphere()

public func hemisphere() -> Hemisphere  
  • Get the hemisphere
  • @return hemisphere

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

easting​And​Northing(_:​)

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

column​Row​Id()

public func columnRowId() -> String  
  • Get the two letter column and row 100k designator
  • @return the two letter column and row 100k designator

grid​Zone()

public func gridZone() -> GridZone?  
  • Get the GZD grid zone
  • @return GZD grid zone

to​Point()

public func toPoint() -> GridPoint  
  • Convert to a point
  • @return point

to​Coordinate()

public func toCoordinate() -> CLLocationCoordinate2D  
  • Convert to a location coordinate
  • @return coordinate

to​UTM()

public func toUTM() -> UTM  
  • Convert to UTM coordinate
  • @return UTM

utm​Easting()

public func utmEasting() -> Double  
  • Get the UTM easting
  • @return UTM easting

utm​Northing()

public func utmNorthing() -> Double  
  • Get the UTM northing
  • @return UTM northing

hash(into:​)

public func hash(into hasher: inout Hasher)  

is​MGRS(_:​)

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(_:​)

public static func from(_ point: GridPoint) -> MGRS  
  • 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(_:​_:​_:​)

public static func from(_ longitude: Double, _ latitude: Double, _ unit: grid_ios.Unit) -> MGRS  
  • 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

parse​ToCoordinate(_:​)

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(_:​_:​)

public static func coordinate(_ point: GridPoint, _ type: GridType?) -> String  
  • 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

column​Row​Id(_:​_:​_:​)

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

column​Letter(_:​)

public static func columnLetter(_ utm: UTM) -> Character  
  • Get the column letter from the UTM
  • @param utm
  •        UTM
    
  • @return column letter

column​Letter(_:​_:​)

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

row​Letter(_:​)

public static func rowLetter(_ utm: UTM) -> Character  
  • Get the row letter from the UTM
  • @param utm
  •        UTM
    
  • @return row letter

row​Letter(_:​_:​)

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

Operators

==

public static func == (lhs: MGRS, rhs: MGRS) -> Bool