ArcObjects Library Reference (Geometry)  

IConversionMGRS.PutCoordsFromMGRS Method

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

[Visual Basic .NET]
Public Sub PutCoordsFromMGRS ( _
    ByVal mgrs As String, _
    ByVal mode As esriMGRSModeEnum _
)
[C#]
public void PutCoordsFromMGRS (
    string mgrs,
    esriMGRSModeEnum mode
);
[C++]
HRESULT PutCoordsFromMGRS(
  BSTR mgrs,
  esriMGRSModeEnum mode
);
[C++]

Parameters

mgrs   mgrs is a parameter of type BSTR mode

  mode is a parameter of type esriMGRSModeEnum

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

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.

 

[C#]

IPoint pnt = new PointClass();

pnt.SpatialReference = //previouly created Spatial Reference

IConversionMGRS convertpnt = pnt as IConversionMGRS;

string MGRSstring = "34SDD4357649756";

convertpnt.PutCoordsFromMGRS(MGRSstring,0)

See Also

IConversionMGRS Interface