ArcGIS Pro 3.4 API Reference Guide
ArcGIS.Core.Geometry Namespace / WktFormatMode Enumeration
Example Example

In This Topic
    WktFormatMode Enumeration
    In This Topic
    Syntax
    Members
    MemberDescription
    AuthorityAll Include authority in all objects
    AuthorityTop Include authority in top-level objects only
    None No authority is included
    Remarks
    When authority is included in the string it will look something like "ID["EPSG",4269]" or "ID["Esri",54004]".
    Example
    SpatialReference WKT2
    SpatialReference sr = SpatialReferences.WebMercator;
    
    // Get Esri WKT
    string wkt = sr.Wkt;
    /*
      PROJCS["WGS_1984_Web_Mercator_Auxiliary_Sphere",
       GEOGCS["GCS_WGS_1984",
        DATUM["D_WGS_1984",
         SPHEROID["WGS_1984", 6378137.0, 298.257223563]],
        PRIMEM["Greenwich", 0.0],
        UNIT["Degree", 0.0174532925199433]],
       PROJECTION["Mercator_Auxiliary_Sphere"],
       PARAMETER["False_Easting", 0.0],
       PARAMETER["False_Northing", 0.0],
       PARAMETER["Central_Meridian", 0.0],
       PARAMETER["Standard_Parallel_1", 0.0],
       PARAMETER["Auxiliary_Sphere_Type", 0.0],
       UNIT["Meter", 1.0]]
    */
    
    // Get OGC WKT2
    string wkt2 = sr.GetWkt2(WktFormatMode.None);
    /*
      PROJCRS["WGS_1984_Web_Mercator_Auxiliary_Sphere",
       BASEGEOGCRS["GCS_WGS_1984",
        DYNAMIC[FRAMEEPOCH[1990.5], MODEL["AM0-2"]],
        DATUM["D_WGS_1984",
         ELLIPSOID["WGS_1984", 6378137.0, 298.257223563, LENGTHUNIT["Meter", 1.0]]],
        PRIMEM["Greenwich", 0.0, ANGLEUNIT["Degree", 0.0174532925199433]],
        CS[ellipsoidal, 2],
        AXIS["Latitude (lat)", north, ORDER[1]],
        AXIS["Longitude (lon)", east, ORDER[2]],
        ANGLEUNIT["Degree", 0.0174532925199433]],
       CONVERSION["Mercator_Auxiliary_Sphere",
        METHOD["Mercator_Auxiliary_Sphere"],
        PARAMETER["False_Easting", 0.0, LENGTHUNIT["Meter", 1.0]],
        PARAMETER["False_Northing", 0.0, LENGTHUNIT["Meter", 1.0]],
        PARAMETER["Central_Meridian", 0.0, ANGLEUNIT["Degree", 0.0174532925199433]],
        PARAMETER["Standard_Parallel_1", 0.0, ANGLEUNIT["Degree", 0.0174532925199433]],
        PARAMETER["Auxiliary_Sphere_Type", 0.0]],
       CS[Cartesian, 2],
       AXIS["Easting (X)", east, ORDER[1]],
       AXIS["Northing (Y)", north, ORDER[2]],
       LENGTHUNIT["Meter", 1.0]]
    */
    
    // You can create a spatial reference with the Esri WKT string or the OCG WKT2 string
    sr = SpatialReferenceBuilder.CreateSpatialReference(wkt2);
    
    // Get OGC WKT2 including authority in top-level objects
    // In this case the authority is written as ID["EPSG",3857]
    wkt2 = sr.GetWkt2(WktFormatMode.AuthorityTop);
    /*  
      PROJCRS["WGS_1984_Web_Mercator_Auxiliary_Sphere",
       BASEGEOGCRS["GCS_WGS_1984",
       DYNAMIC[FRAMEEPOCH[1990.5],MODEL["AM0-2"]],
       DATUM["D_WGS_1984",
        ELLIPSOID["WGS_1984",6378137.0,298.257223563,LENGTHUNIT["Meter",1.0]]],
       PRIMEM["Greenwich",0.0,ANGLEUNIT["Degree",0.017453292519943295]],
       CS[ellipsoidal,2],
       AXIS["Latitude (lat)",north,ORDER[1]],
       AXIS["Longitude(lon)",east,ORDER[2]],
       ANGLEUNIT["Degree",0.017453292519943295]],
       CONVERSION["Mercator_Auxiliary_Sphere",
        METHOD["Mercator_Auxiliary_Sphere"],
        PARAMETER["False_Easting",0.0,LENGTHUNIT["Meter",1.0]],
        PARAMETER["False_Northing",0.0,LENGTHUNIT["Meter",1.0]],
        PARAMETER["Central_Meridian",0.0,ANGLEUNIT["Degree",0.017453292519943295]],
        PARAMETER["Standard_Parallel_1",0.0,ANGLEUNIT["Degree",0.017453292519943295]],
        PARAMETER["Auxiliary_Sphere_Type",0.0]],
        CS[Cartesian,2],
        AXIS["Easting (X)",east,ORDER[1]],
        AXIS["Northing (Y)",north,ORDER[2]],
        LENGTHUNIT["Meter",1.0],
        ID["EPSG",3857]]
    */
    
    // Get OGC WKT2 including authority in all objects
    // Authority is written as ID["ESPG",<id>] or ID["Esri",<id>]
    wkt2 = sr.GetWkt2(WktFormatMode.AuthorityAll);
    /*
      PROJCRS["WGS_1984_Web_Mercator_Auxiliary_Sphere",
       BASEGEOGCRS["GCS_WGS_1984",
        DYNAMIC[FRAMEEPOCH[1990.5],MODEL["AM0-2"]],
        DATUM["D_WGS_1984",
         ELLIPSOID["WGS_1984",6378137.0,298.257223563,LENGTHUNIT["Meter",1.0,ID["EPSG",9001]],ID["EPSG",7030]],
         ID["EPSG",6326]],
        PRIMEM["Greenwich",0.0,ANGLEUNIT["Degree",0.017453292519943295,ID["EPSG",9102]],ID["EPSG",8901]],
        CS[ellipsoidal,2],
        AXIS["Latitude (lat)",north,ORDER[1]],
        AXIS["Longitude(lon)",east,ORDER[2]],
        ANGLEUNIT["Degree",0.017453292519943295,ID["EPSG",9102]],ID["EPSG",4326]],
        CONVERSION["Mercator_Auxiliary_Sphere",
         METHOD["Mercator_Auxiliary_Sphere",ID["Esri",43104]],
         PARAMETER["False_Easting",0.0,LENGTHUNIT["Meter",1.0,ID["EPSG",9001]],ID["Esri",100001]],
         PARAMETER["False_Northing",0.0,LENGTHUNIT["Meter",1.0,ID["EPSG",9001]],ID["Esri",100002]],
         PARAMETER["Central_Meridian",0.0,ANGLEUNIT["Degree",0.017453292519943295,ID["EPSG",9102]],ID["Esri",100010]],
         PARAMETER["Standard_Parallel_1",0.0,ANGLEUNIT["Degree",0.017453292519943295,ID["EPSG",9102]],ID["Esri",100025]],
         PARAMETER["Auxiliary_Sphere_Type",0.0,ID["Esri",100035]]],
        CS[Cartesian,2],
        AXIS["Easting(X)",east,ORDER[1]],
        AXIS["Northing (Y)",north,ORDER[2]],
        LENGTHUNIT["Meter",1.0,ID["EPSG",9001]],
        ID["EPSG",3857]]
    */
    
    Inheritance Hierarchy

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

    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3.2 or higher.
    See Also