When working with a SpatialReference selected from the ArcGIS.Desktop.Mapping.Controls.CoordinateSystemsControl, sometimes the (ArcGIS.Core.Geometry) SpatialReference wkt is in old wkt format and other times it is in wkt2.
I need to always convert to wkt1. How can I do that?
Edit: We are on Esri.ArcGISPro.Extensions30 v3.1 and cannot upgrade since we are currently targeting .net6
I updated to the nuget package v3.2.x. For the spatial reference Wkid 9748,
NAD_1983_2011_StatePlane_Alabama_East_(ftUS) GetWkt2 and Wkt both have the same Wkt2 format ("PROJCRS...")
string test1 = spatialReference.GetWkt2(WktFormatMode.None);
string test2 = spatialReference.Wkt;I would expect Wkt to be in the original Wkt format here ("PROJCS..")
Hi Karl, you are right. It should be the original wkt. This will be fixed in the next release, but in the meantime, if you recreate the spatial reference using the wkid, the newly created spatial reference should have the original wkt.
Do you know how many spatial references are impacted by this bug? Did I just happen to stumble on an outlier?
When you say fixed in the next release, are you referring to the Desktop application or the SDK?
@AnnetteLocke wrote:if you recreate the spatial reference using the wkid, the newly created spatial reference should have the original wkt.
I was unable to get this to work. Shown below is my code (API v3.1). The WKT on both spatial references are equal and in wkt2 format
var srNewlyBuilt = SpatialReferenceBuilder.CreateSpatialReference(spatialReference.Wkid);
bool isWktEqual = srNewlyBuilt.Wkt.Equals(spatialReference.Wkt, StringComparison.OrdinalIgnoreCase);