Method ToUsng
ToUsng(MapPoint, Int32, Boolean)
Returns a formatted coordinate string in United States National Grid (USNG) notation representing the given MapPoint's location.
Declaration
public static string ToUsng(MapPoint point, int precision, bool addSpaces)
Parameters
| Type | Name | Description |
|---|---|---|
| MapPoint | point | The location to be represented in USNG notation. It must have a SpatialReference set. |
| System.Int32 | precision | The precision with which to represent the coordinate. Value is expected to be between 0 to 8 (inclusive), and will be clamped if necessary. |
| System.Boolean | addSpaces | If |
Returns
| Type | Description |
|---|---|
| System.String | A USNG notation string representing the position of the given MapPoint. |
Remarks
The precision value controls the number of digits used to represent each numerical easting and northing value within the USNG string. For example:
precisionparameter value |
addSpacesparameter value |
Example output | Approximate precision (to 1 significant figure) |
|---|---|---|---|
| 0 | false | 13TFJ |
100km |
| 1 | false | 13TFJ25 |
10km |
| 2 | false | 13TFJ2359 |
1km |
| 3 | false | 13TFJ237595 |
100m |
| 4 | false | 13TFJ23745951 |
10m |
| 5 | false | 13TFJ2374359512 |
1m |
| 0 | true | 13T FJ |
100km |
| 1 | true | 13T FJ 2 5 |
10km |
| 2 | true | 13T FJ 23 59 |
1km |
| 3 | true | 13T FJ 237 595 |
100m |
| 4 | true | 13T FJ 2374 5951 |
10m |
| 5 | true | 13T FJ 23743 59512 |
1m |
If the point's SpatialReference is NAD 27, then a suffix is added to the
end of the formatted string. For example:
precisionparameter value |
addSpacesparameter value |
Example output | Approximate precision (to 1 significant figure) |
|---|---|---|---|
| 4 | false | 13TFJ23795929 (NAD 27) |
10m |
| 2 | true | 13T FJ 23 59 (NAD 27) |
1km |
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException |
|
| System.ArgumentException |
|
Applies to
Platforms and versions
| Target | Versions |
|---|---|
| .NET Standard 2.0 | 100.3 - 200.8 |
| .NET | 100.13 - 200.8 |
| .NET Windows | 100.13 - 200.8 |
| .NET Android | 200.0 - 200.8 |
| .NET iOS | 200.0 - 200.8 |
| .NET Framework | 100.1 - 200.8 |
| Xamarin.Android | 100.1 - 100.15 |
| Xamarin.iOS | 100.1 - 100.15 |
| UWP | 100.1 - 200.8 |