From c9c656999baa3ce4e7a9b988733a7d3739e7d67a Mon Sep 17 00:00:00 2001 From: ClemensF Date: Wed, 29 Aug 2018 21:06:56 +0200 Subject: [PATCH] Version 4.10.0: Added MapProjections library project. --- MapProjections/Shared/GeoApiProjection.cs | 9 +++++---- MapProjections/Shared/UtmProjection.cs | 5 ++++- 2 files changed, 9 insertions(+), 5 deletions(-) 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); } } }