Visual Basic (Declaration) | |
---|---|
Public Shared Function MapPointsToMgrs( _ ByVal points As IEnumerable(Of MapPoint), _ ByVal conversionMode As MgrsConversionMode, _ ByVal numberOfDigits As Integer, _ ByVal roundToNearestWholeNumber As Boolean, _ ByVal addSpaces As Boolean _ ) As IList(Of String) |
C# | |
---|---|
public static IList<string> MapPointsToMgrs( IEnumerable<MapPoint> points, MgrsConversionMode conversionMode, int numberOfDigits, bool roundToNearestWholeNumber, bool addSpaces ) |
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 a value 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
- points
- A IEnumerable of MapPoint representing the locations to be converted. Each MapPoint must share the same SpatialReference. 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 precision of the numerical portion of the 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 IList of System.String of coordinate notations representing the locations defined by the MapPoints.Exception | Description |
---|---|
System.ArgumentException | The numerOfDigits parameter must be greater than or equal to 1. |
Target Platforms: Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family, Windows 7, Windows 8