ArcGIS Pro 2.7 API Reference Guide
ToGeoCoordinateParameter Constructor(GeoCoordinateType,ToGeoCoordinateMode,Int32,Boolean,Boolean)
Example 

ArcGIS.Core.Geometry Namespace > ToGeoCoordinateParameter Class > ToGeoCoordinateParameter Constructor : ToGeoCoordinateParameter Constructor(GeoCoordinateType,ToGeoCoordinateMode,Int32,Boolean,Boolean)
Tthe coordinate string notation.
The format of the coordinate string.
The number of digits the string is to carry. Controls the precision.
True - the values of the UTM coordinates will be rounded. False - the values of the UTM coordinates will be truncated.
Add spaces to output.
Create a new instance of ToGeoCoordinateParameter.
Syntax

Parameters

geoCoordType
Tthe coordinate string notation.
geoCoordMode
The format of the coordinate string.
numDigits
The number of digits the string is to carry. Controls the precision.
Rounding
True - the values of the UTM coordinates will be rounded. False - the values of the UTM coordinates will be truncated.
addSpaces
Add spaces to output.
Example
SpatialReference sr = SpatialReferences.WGS84;
SpatialReference sr2 = SpatialReferences.WebMercator;

// create some points
MapPoint point0 = MapPointBuilder.CreateMapPoint(0, 0, sr);
MapPoint point1 = MapPointBuilder.CreateMapPoint(10, 20, sr);
MapPoint point2 = GeometryEngine.Instance.Project(point1, sr2) as MapPoint;
MapPoint pointEmpty = MapPointBuilder.CreateMapPoint(sr);
MapPoint pointwithNoSR = MapPointBuilder.CreateMapPoint(1, 1);
MapPoint pointZM = MapPointBuilder.CreateMapPoint(1, 2, 3, 4, sr);

// convert to MGRS
ToGeoCoordinateParameter mgrsParam = new ToGeoCoordinateParameter(GeoCoordinateType.MGRS);
string geoCoordString = point0.ToGeoCoordinateString(mgrsParam);        // 31NAA6602100000

// use the builder to create a new point from the string.  Coordinates are the same 
MapPoint outPoint = MapPointBuilder.FromGeoCoordinateString(geoCoordString, sr, GeoCoordinateType.MGRS);    // outPoint.x = 0; outPoint.Y = 0

geoCoordString = point1.ToGeoCoordinateString(mgrsParam);             // 32QPH0460911794
outPoint = MapPointBuilder.FromGeoCoordinateString(geoCoordString, sr, GeoCoordinateType.MGRS);       // outPoint.X = 10; outPoint.Y = 20

// z, m are not transformed
geoCoordString = pointZM.ToGeoCoordinateString(mgrsParam);
outPoint = MapPointBuilder.FromGeoCoordinateString(geoCoordString, sr, GeoCoordinateType.MGRS);     // outPoint.X = 1; outPoint.Y = 2; outPoint.Z = Nan; outPoint.M = Nan;

// set the number of digits to 2 and convert
mgrsParam.NumDigits = 2;
geoCoordString = point1.ToGeoCoordinateString(mgrsParam);             // 32QPH0512
outPoint = MapPointBuilder.FromGeoCoordinateString(geoCoordString, sr, GeoCoordinateType.MGRS);     // outPoint.X = 10; outPoint.Y = 20


// convert to UTM
ToGeoCoordinateParameter utmParam = new ToGeoCoordinateParameter(GeoCoordinateType.UTM);
geoCoordString = point0.ToGeoCoordinateString(utmParam);        // 31N 166021 0000000
geoCoordString = point1.ToGeoCoordinateString(utmParam);        // 32Q 604609 2211793

// convert to DMS
ToGeoCoordinateParameter dmsParam = new ToGeoCoordinateParameter(GeoCoordinateType.DMS);
geoCoordString = point0.ToGeoCoordinateString(dmsParam);        // 00 00 00.00N 000 00 00.00E
geoCoordString = point1.ToGeoCoordinateString(dmsParam);        // 20 00 00.00N 010 00 00.00E

// convert to DDM
ToGeoCoordinateParameter ddmParam = new ToGeoCoordinateParameter(GeoCoordinateType.DDM);
geoCoordString = point0.ToGeoCoordinateString(ddmParam);        // 00 00.0000N 000 00.0000E
geoCoordString = point1.ToGeoCoordinateString(ddmParam);        // 20 00.0000N 010 00.0000E

// convert to DD
ToGeoCoordinateParameter ddParam = new ToGeoCoordinateParameter(GeoCoordinateType.DD);
geoCoordString = point0.ToGeoCoordinateString(ddParam);       // 00.000000N 000.000000E
geoCoordString = point1.ToGeoCoordinateString(ddParam);       // 20.000000N 010.000000E
Requirements

Target Platforms: Windows 10, Windows 8.1

See Also

Reference

ToGeoCoordinateParameter Class
ToGeoCoordinateParameter Members
Overload List
GeoCoordinateType Enumeration
ToGeoCoordinateMode Enumeration