ArcGIS Runtime SDK for WPF - Library Reference
MapPointToMgrs Method
See Also 
ESRI.ArcGIS.Client.Geometry Namespace > CoordinateConversion Class : MapPointToMgrs Method

point
A MapPoint representing the location to be converted. Note that the location defined by an MGRS coordinate string is an area, not a specific point.
conversionMode
A MgrsConversionMode value determining the spheroid used in the conversion and the zone in which the 180 longitude falls.
numberOfDigits
A System.Int32 greater than or equal to 1 and typically less than or equal to 5 indicating the required precision of returned MGRS coordinate string.
roundToNearestWholeNumber
true if the MGRS coordinate should be rounded to produce a lower precision coordinate notation; otherwise false to truncate the coordinate notation.
addSpaces
true if spaces should be added to the returned MGRS coordinate notation; otherwise false.
Converts a MapPoint geometry to a coordinate notation string in the Military Grid Reference System (MGRS) format. The MapPoint must have a valid SpatialReference.

Syntax

Visual Basic (Declaration) 
Public Shared Function MapPointToMgrs( _
   ByVal point As MapPoint, _
   ByVal conversionMode As MgrsConversionMode, _
   ByVal numberOfDigits As Integer, _
   ByVal roundToNearestWholeNumber As Boolean, _
   ByVal addSpaces As Boolean _
) As String
C# 
public static string MapPointToMgrs( 
   MapPoint point,
   MgrsConversionMode conversionMode,
   int numberOfDigits,
   bool roundToNearestWholeNumber,
   bool addSpaces
)

Remarks

The Military Grid Reference System (MGRS) is a grid-based system used to represent locations on the universal transverse Mercator (UTM) and universal polar stereographic (UPS) grid systems, expressed as an alphanumeric string. An MGRS coordinate defines an area on the Earth's surface as opposed to a specific point. A fully qualified MGRS string is 15 characters long and consists of the following three components: grid zone designation, 100,000-meter square identifier, and easting/northing.

The number of digits refers to the digits in each part of the numerical grid reference and must be greater than or equal to 1 and typically less than or equal to 5 , indicating the precision as follows:

  • 1 digit represents 10,000m precision e.g. 18SUU80
  • 2 digits represents 1,000m precision e.g. 18SUU8401
  • 3 digits represents 100m precision e.g. 18SUU836014
  • 4 digits represents 10m precision e.g. 18SUU83630143
  • 5 digits represents 1m precision e.g. 18SUU8362601432

When changing precision levels, it is important to truncate rather than round the easting and northing values to ensure the more precise polygon will remain within the boundaries of the less precise polygon.

Parameters

point
A MapPoint representing the location to be converted. Note that the location defined by an MGRS coordinate string is an area, not a specific point.
conversionMode
A MgrsConversionMode value determining the spheroid used in the conversion and the zone in which the 180 longitude falls.
numberOfDigits
A System.Int32 greater than or equal to 1 and typically less than or equal to 5 indicating the required precision of returned MGRS coordinate string.
roundToNearestWholeNumber
true if the MGRS coordinate should be rounded to produce a lower precision coordinate notation; otherwise false to truncate the coordinate notation.
addSpaces
true if spaces should be added to the returned MGRS coordinate notation; otherwise false.

Return Value

A System.String in the requested coordinate notation format representing the location defined by the MapPoint.

Exceptions

ExceptionDescription
System.ArgumentExceptionThe numerOfDigits parameter must be greater than or equal to 1.

Requirements

Target Platforms: Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family, Windows 7, Windows 8

See Also

© ESRI, Inc. All Rights Reserved.