IConversionMGRS Interface

Provides access to members that allow the use of MGRS.

Description

IConversionMGRS contains methods for converting both projected and geographic (lat/lon) coordinates to and from a string in the Military Grid Reference System (MGRS). The MGRS is based on Universal Transverse Mercator(UTM) coordinates. A simplified version of MGRS is used in the United States National Grid (USNG). A single string can be used to represent any point on the Earth's surface with MGRS/USNG.

Members

Name Description
Method CreateMGRS Returns the MGRS/USNG description of a point.
Method PutCoordsFromMGRS Creates the coordinates of a point from the MGRS/USNG description.

IConversionMGRS.CreateMGRS Method

Returns the MGRS/USNG description of a point.

Public Function CreateMGRS ( _
    ByVal numDigits As Integer, _
    ByVal round As Boolean, _
    ByVal mode As esriMGRSModeEnum _
) As String
public string CreateMGRS (
    int numDigits,
    bool round,
    esriMGRSModeEnum mode
);

Description

This method creates a single string description in MGRS/USNG for any Point on the Earth's surface. A string variable is needed to store this alphanumeric string. MGRS stands for military grid reference system while USNG is the United States National Grid. CreateMGRS takes three inputs.

The first is the integer number of digits you wish the string to carry and controls the precision.

0: To approximately 100 kilometers depending on where on earth the point is.

5: To a square meter (This is the standard for MGRS/USNG).

8: To a square millimeter. This is the best precision possible and using a larger number will not result in greater precision.

The second input parameter is a boolean that represents rounding.

True: The values of the UTM coordinates will be rounded.

False: The values of the UTM coordinates will be truncated.

The second is the esriMGRSModeEnum and determines how to handle the geographic coordinate system of the spatial reference. Certain older geographic coordinate systems will cause one of the letters of the string to be shifted. This process makes it easier to identify coordinates that are based on a non-WGS84 datum.

esriMGRSModeEnum:

esriMGRSMode_Automatic: the geographic coordinate system is handled for you

esriMGRSMode_NewStyle: the geographic coordinate system is treated as if it is WGS84

esriMGRSMode_NewWith180InZone01: the geographic coordinate system is treated as if it is WGS84 and a point at 180E will be forced into UTM zone 1.

esriMGRSMode_OldStyle: the geographic coordinate system is treated as if it is an older non-WGS84 datum, particularly one that is based on the Clarke 1866 or Bessel spheroids.

esriMGRSMode_OldWith180InZone01: the geographic coordinate system is treated as if it is an older non-WGS84 datum, particularly one that is based on the Clarke 1866 or Bessel spheroids and a point at 180E will be forced into UTM zone 1.

esriMGRSMode_USNG: USNG does not differentiate between older and newer geographic coordinate systems.

IPoint pnt = new PointClass();

pnt.SpatialReference =// previously created Spatial Reference;

IConversionMGRS convertpnt = pnt as IConversionMGRS;

string MGRSstring = convertpnt.CreateMGRS(5,true,0);

IConversionMGRS.PutCoordsFromMGRS Method

Creates the coordinates of a point from the MGRS/USNG description.

Public Sub PutCoordsFromMGRS ( _
    ByVal mgrs As String, _
    ByVal mode As esriMGRSModeEnum _
)
public void PutCoordsFromMGRS (
    string mgrs,
    esriMGRSModeEnum mode
);

Description

Creates the coordinates of a point from the MGRS/USNG string description. MGRS stands for military grid reference system while USNG is the United States National Grid. The Point being used must already have a defined spatial reference. The coordinate system cannot be unknown. PutCoordsFromMGRS takes two inputs. The first is the MGRS string that you want to convert. The second is the esriMGRSModeEnum and determines how to handle the geographic coordinate system of the spatial reference. Certain older geographic coordinate systems will cause one of the letters of the string to be shifted. This process makes it easier to identify coordinates that are based on a non-WGS84 datum.

esriMGRSModeEnum:

esriMGRSMode_Automatic: the geographic coordinate system is handled for you

esriMGRSMode_NewStyle: the geographic coordinate system is treated as if it is WGS84

esriMGRSMode_NewWith180InZone01: the geographic coordinate system is treated as if it is WGS84 and a point at 180E will be forced into UTM zone 1.

esriMGRSMode_OldStyle: the geographic coordinate system is treated as if it is an older non-WGS84 datum, particularly one that is based on the Clarke 1866 or Bessel spheroids.

esriMGRSMode_OldWith180InZone01: the geographic coordinate system is treated as if it is an older non-WGS84 datum, particularly one that is based on the Clarke 1866 or Bessel spheroids and a point at 180E will be forced into UTM zone 1.

esriMGRSMode_USNG: USNG does not differentiate between older and newer geographic coordinate systems.

IPoint pnt = new PointClass();

pnt.SpatialReference = //previouly created Spatial Reference

IConversionMGRS convertpnt = pnt as IConversionMGRS;

string MGRSstring = "34SDD4357649756";

convertpnt.PutCoordsFromMGRS(MGRSstring,0)

Classes that implement IConversionMGRS

Classes Description
Point A two dimensional point, optionally with measure, height, and ID attributes.

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.