Click or drag to resize
MGRSRef Class
doogal.co.uk Home



Class to represent a Military Grid Reference System (MGRS) reference.

Military Grid Reference System (MGRS)

The Military Grid Reference System (MGRS) is an extension of the Universal Transverse Mercator (UTM) reference system. An MGRS reference is made from 5 parts:

UTM Longitude Zone

This is a number indicating which UTM longitude zone the reference falls into. Zones are numbered from 1 (starting at 180°W) through 60. Each zone is 6° wide.

UTM Latitude Zone

Latitude is split into regions that are 8° high, starting at 80°S. Latitude zones are lettered using C through X, but omitting I and O as they can easily be confused with the numbers 1 and 0.

100,000m Square identification

Each UTM zone is treated as a square 100,000m to a side. The 50,000m easting is centred on the centre-point of the UTM zone. 100,000m squares are identified using two characters - one to identify the row and one to identify the column.

Row identifiers use the characters A through V (omitting I and O again). The sequence is repeated every 2,000,000m from the equator. If the UTM longitude zone is odd, then the lettering is advanced by five characters to start at F.

Column identifiers use the characters A through Z (again omitting I and O).

Easting and northing

Each 100,000m grid square is further divided into smaller squares representing 1m, 10m, 100m, 1,000m and 10,000m precision. The easting and northing are given using the numeric row and column reference of the square, starting at the bottom-left corner of the square.

MGRS Reference Example

18SUU8362601432 is an example of an MGRS reference. '18' is the UTM longitude zone, 'S' is the UTM latitude zone, 'UU' is the 100,000m square identification, 83626 is the easting reference to 1m precision and 01432 is the northing reference to 1m precision.

MGRSRef

Methods are provided to query an MGRSRef object for its parameters. As MGRS references are related to UTM references, a ToUTMRef method is provided to convert an MGRSRef object into a UTMRef object. The reverse conversion can be made using the MGRSRef(UTMRef) constructor.

MGRSRef objects can be converted to LatLng objects using the ToLatLng method. The reverse conversion is made using the ToMGRSRef method.

Some MGRS references use the Bessel 1841 ellipsoid rather than the Geodetic Reference System 1980 (GRS 1980), International or World Geodetic System 1984 (WGS84) ellipsoids. Use the constructors with the optional boolean parameter to be able to specify whether your MGRS reference uses the Bessel 1841 ellipsoid. Note that no automatic determination of the correct ellipsoid to use is made.

Important note: There is currently no support for MGRS references in polar regions north of 84°N and south of 80°S. There is also no account made for UTM zones with slightly different sizes to normal around Svalbard and Norway.

Inheritance Hierarchy

Namespace: DotNetCoords
Assembly: DotNetCoords (in DotNetCoords.dll) Version: 1.0.0.15 (1.0.0.15)
Syntax
public class MGRSRef : CoordinateSystem

The MGRSRef type exposes the following members.

Constructors
  NameDescription
Public methodMGRSRef(String)
Create a new MGRS reference object from the given String. Must be correctly formatted otherwise an IllegalArgumentException will be thrown. It is assumed that this MGRS reference represents a point using the GRS 1980, International or WGS84 ellipsoids.
Public methodMGRSRef(UTMRef)
Create a new MGRS reference object from the given UTM reference. It is assumed that the UTMRef object is valid.
Public methodMGRSRef(String, Boolean)
Create a new MGRS reference object from the given String. Must be correctly formatted otherwise an ArgumentException will be thrown. Matching regex: (\d{1,2})([A-Z])([A-Z])([A-Z])(\d{2,10})
Public methodMGRSRef(UTMRef, Boolean)
Create a new MGRS reference object from the given UTM reference. It is assumed that this MGRS reference represents a point using the GRS 1980, International or WGS84 ellipsoids. It is assumed that the UTMRef object is valid.
Public methodMGRSRef(Int32, Char, Char, Char, Int32, Int32, Precision)
Create a new MGRS reference object from the given paramaters. It is assumed that this MGRS reference represents a point using the GRS 1980, International or WGS84 ellipsoids. An IllegalArgumentException is thrown if any of the parameters are invalid.
Public methodMGRSRef(Int32, Char, Char, Char, Int32, Int32, Precision, Boolean)
Create a new MGRS reference object from the given parameters. An ArgumentException is thrown if any of the parameters are invalid.
Top
Methods
  NameDescription
Public methodEquals
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetHashCode
Serves as a hash function for a particular type.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodIsBessel
Determines whether this instance represents an MGRS reference using the Bessel 1841 ellipsoid.
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodToLatLng
Convert this MGRS reference to a latitude and longitude.
(Overrides CoordinateSystemToLatLng.)
Public methodToString
Return a string representation of this MGRS Reference to whatever precision this reference is set to.
(Overrides ObjectToString.)
Public methodToString(Precision)
Return a String representation of this MGRS reference to 1m, 10m, 100m, 1000m or 10000m precision.
Public methodToUTMRef
Convert this MGRS reference to an equivelent UTM reference. This method based on http://www.stellman-greene.com/mgrs_to_utm/
Top
Properties
  NameDescription
Public propertyDatum
Gets the datum.
(Inherited from CoordinateSystem.)
Public propertyEasting
Gets the easting.
Public propertyEastingId
Gets the easting ID.
Public propertyNorthing
Gets the northing.
Public propertyNorthingId
Gets the northing ID.
Public propertyPrecision
Gets the precision.
Public propertyUtmZoneChar
Gets the UTM zone character representing the latitude.
Public propertyUtmZoneNumber
Gets the UTM zone number representing the longitude.
Top
See Also