ArcGIS Pro 3.3 API Reference Guide
ArcGIS.Core.Geometry Namespace / GeoCoordinateType Enumeration
Example Example

In This Topic
    GeoCoordinateType Enumeration
    In This Topic
    Options for representing different coordinate string notations. Used with the ToGeoCoordinateParameter class as part of the MapPoint.ToGeoCoordinateString and MapPointBuilderEx.FromGeoCoordinateString functions.
    Syntax
    Members
    MemberDescription
    DD Decimal Degree.
    DDM Degree Decimal Minute.
    DMS Degree Minute Second.
    GARS Global Area Reference System.
    GeoRef World Geographic Reference System.
    MGRS Military Grid Reference System.
    USNG United States National Grid.
    UTM Universal Transverse Mercator.
    Example
    MapPoint - GeoCoordinateString Conversion
    SpatialReference sr = SpatialReferences.WGS84;
    SpatialReference sr2 = SpatialReferences.WebMercator;
    
    // create some points
    MapPoint point0 = MapPointBuilderEx.CreateMapPoint(0, 0, sr);
    MapPoint point1 = MapPointBuilderEx.CreateMapPoint(10, 20, sr);
    MapPoint point2 = GeometryEngine.Instance.Project(point1, sr2) as MapPoint;
    MapPoint pointEmpty = MapPointBuilderEx.CreateMapPoint(sr);
    MapPoint pointwithNoSR = MapPointBuilderEx.CreateMapPoint(1, 1);
    MapPoint pointZM = MapPointBuilderEx.CreateMapPoint(1, 2, 3, 4, sr);
    
    // convert to MGRS
    ToGeoCoordinateParameter mgrsParam = 
             new ToGeoCoordinateParameter(GeoCoordinateType.MGRS);
    // 31NAA6602100000
    string geoCoordString = point0.ToGeoCoordinateString(mgrsParam);
    
    // use the builder to create a new point from the string.
    // Coordinates are the same 
    // outPoint.x = 0; outPoint.Y = 0
    MapPoint outPoint = 
          MapPointBuilderEx.FromGeoCoordinateString(
                    geoCoordString, sr, GeoCoordinateType.MGRS);
    
    // 32QPH0460911794
    // outPoint.X = 10; outPoint.Y = 20
    geoCoordString = point1.ToGeoCoordinateString(mgrsParam);             
    outPoint = MapPointBuilderEx.FromGeoCoordinateString(
               geoCoordString, sr, GeoCoordinateType.MGRS);
    
    // z, m are not transformed
    // outPoint.X = 1; outPoint.Y = 2; outPoint.Z = Nan; outPoint.M = Nan;
    geoCoordString = pointZM.ToGeoCoordinateString(mgrsParam);
    outPoint = MapPointBuilderEx.FromGeoCoordinateString(
      geoCoordString, sr, GeoCoordinateType.MGRS);
    
    // set the number of digits to 2 and convert
    // 32QPH0512
    // outPoint.X = 10; outPoint.Y = 20
    mgrsParam.NumDigits = 2;
    geoCoordString = point1.ToGeoCoordinateString(mgrsParam);             
    outPoint = MapPointBuilderEx.FromGeoCoordinateString(
      geoCoordString, sr, GeoCoordinateType.MGRS);     
    
    
    // convert to UTM
    ToGeoCoordinateParameter utmParam = 
         new ToGeoCoordinateParameter(GeoCoordinateType.UTM);
    // 31N 166021 0000000
    geoCoordString = point0.ToGeoCoordinateString(utmParam);
    // 32Q 604609 2211793
    geoCoordString = point1.ToGeoCoordinateString(utmParam);        
    
    // convert to DMS
    ToGeoCoordinateParameter dmsParam = 
      new ToGeoCoordinateParameter(GeoCoordinateType.DMS);
    // 00 00 00.00N 000 00 00.00E
    geoCoordString = point0.ToGeoCoordinateString(dmsParam);
    // 20 00 00.00N 010 00 00.00E
    geoCoordString = point1.ToGeoCoordinateString(dmsParam);        
    
    // convert to DDM
    ToGeoCoordinateParameter ddmParam = 
      new ToGeoCoordinateParameter(GeoCoordinateType.DDM);
    // 00 00.0000N 000 00.0000E
    geoCoordString = point0.ToGeoCoordinateString(ddmParam);
    // 20 00.0000N 010 00.0000E
    geoCoordString = point1.ToGeoCoordinateString(ddmParam);        
    
    // convert to DD
    ToGeoCoordinateParameter ddParam = 
      new ToGeoCoordinateParameter(GeoCoordinateType.DD);
    // 00.000000N 000.000000E
    geoCoordString = point0.ToGeoCoordinateString(ddParam);
    // 20.000000N 010.000000E
    geoCoordString = point1.ToGeoCoordinateString(ddParam);       
    
    Inheritance Hierarchy

    System.Object
       System.ValueType
          System.Enum
             ArcGIS.Core.Geometry.GeoCoordinateType

    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also