When you work with layers in one coordinate system and need to convert them to another coordinate system, the ConvertCoordinate
static class is your friend. With this class, you can convert back and forth between the Global Area Reference
System (GARS) of National Geospatial-Intelligence
Agency (NGA), latitude/longitude, Military Grid Reference System (MGRS), U. S. National
Grid (USNG), and Universe Transverse
Mercator (UTM). GARS and MGRS are particularly relevant to the military. For more information on GARS, UTM, MGRS, and USNG, navigate to http://earth-info.nga.mil/GandG/coordsys/grids/referencesys.html.
Here is an example of converting a latitude/longitude to MGRS:
MapPoint mapPointLatLon = new MapPoint(0, 0, SpatialReferences.Wgs84); string coord = ConvertCoordinate.ToMgrs(mapPointLatLon, MgrsConversionMode.Automatic, 2, false, false);
The resulting string will contain a value that looks like this: 31NAA6600
. Another example illustrates converting from decimal degrees to degrees, minutes, and seconds:
MapPoint mapPointLatLon = new MapPoint(-177.23, 45.884, SpatialReferences.Wgs84); string coord = ConvertCoordinate.ToDegreesMinutesSeconds(mapPointLatLon, 5);