diff --git a/MapProjections/Shared/GeoApiProjection.cs b/MapProjections/Shared/GeoApiProjection.cs index 5b41ae72..480fe16f 100644 --- a/MapProjections/Shared/GeoApiProjection.cs +++ b/MapProjections/Shared/GeoApiProjection.cs @@ -23,7 +23,6 @@ namespace MapControl.Projections private ICoordinateTransformation coordinateTransform; private IMathTransform mathTransform; private IMathTransform inverseTransform; - private string wkt; /// /// Gets or sets the underlying ICoordinateTransformation instance. @@ -52,16 +51,18 @@ namespace MapControl.Projections /// e.g. a PROJCS[...] string as used by https://epsg.io or http://spatialreference.org. /// Setting this property updates the CoordinateTransform property. /// - public string Wkt + public string WKT { - get { return wkt; } + get + { + return coordinateTransform?.TargetCS?.WKT; + } set { var sourceCs = GeographicCoordinateSystem.WGS84; var targetCs = (ICoordinateSystem)CoordinateSystemWktReader.Parse(value, Encoding.UTF8); CoordinateTransform = new CoordinateTransformationFactory().CreateFromCoordinateSystems(sourceCs, targetCs); - wkt = value; } } diff --git a/MapProjections/Shared/UtmProjection.cs b/MapProjections/Shared/UtmProjection.cs index 9b8e7fe5..561bad80 100644 --- a/MapProjections/Shared/UtmProjection.cs +++ b/MapProjections/Shared/UtmProjection.cs @@ -46,9 +46,12 @@ namespace MapControl.Projections zoneName = value; epsgCode += zoneNumber; + var centralMeridian = 6 * zoneNumber - 183; - Wkt = string.Format(wktFormat, zoneName, 6 * zoneNumber - 183, falseNorthing, epsgCode); + WKT = string.Format(wktFormat, zoneName, centralMeridian, falseNorthing, epsgCode); TrueScale = 0.9996 * MetersPerDegree; + + System.Diagnostics.Debug.WriteLine(WKT); } } }