Improved MapProjections

This commit is contained in:
ClemensF 2019-10-27 17:46:44 +01:00
parent ca004651bd
commit 558dd2f98a

View file

@ -25,7 +25,7 @@ namespace MapControl.Projections
public IMathTransform PointToLocationTransform { get; private set; } public IMathTransform PointToLocationTransform { get; private set; }
/// <summary> /// <summary>
/// Gets or sets the IProjectedCoordinateSystem of the MapProjection. /// Gets or sets the ICoordinateSystem of the MapProjection.
/// </summary> /// </summary>
public ICoordinateSystem CoordinateSystem public ICoordinateSystem CoordinateSystem
{ {
@ -55,11 +55,10 @@ namespace MapControl.Projections
IsWebMercator = CrsId == "EPSG:3857" || CrsId == "EPSG:900913"; IsWebMercator = CrsId == "EPSG:3857" || CrsId == "EPSG:900913";
var projectedCoordinateSystem = coordinateSystem as IProjectedCoordinateSystem; var projection = (coordinateSystem as IProjectedCoordinateSystem)?.Projection;
if (projectedCoordinateSystem != null) if (projection != null)
{ {
var projection = projectedCoordinateSystem.Projection;
var centralMeridian = projection.GetParameter("central_meridian") ?? projection.GetParameter("longitude_of_origin"); var centralMeridian = projection.GetParameter("central_meridian") ?? projection.GetParameter("longitude_of_origin");
var centralParallel = projection.GetParameter("latitude_of_origin") ?? projection.GetParameter("central_parallel"); var centralParallel = projection.GetParameter("latitude_of_origin") ?? projection.GetParameter("central_parallel");
var falseEasting = projection.GetParameter("false_easting"); var falseEasting = projection.GetParameter("false_easting");
@ -82,9 +81,9 @@ namespace MapControl.Projections
} }
/// <summary> /// <summary>
/// Gets or sets an OGC Well-known text representation of a projected coordinate system, /// Gets or sets an OGC Well-known text representation of a coordinate system,
/// i.e. a PROJCS[...] string as used by https://epsg.io or http://spatialreference.org. /// i.e. a PROJCS[...] or GEOGCS[...] string as used by https://epsg.io or http://spatialreference.org.
/// Setting this property updates the CoordinateSystem property with an IProjectedCoordinateSystem created from the WKT string. /// Setting this property updates the CoordinateSystem property with an ICoordinateSystem created from the WKT string.
/// </summary> /// </summary>
public string WKT public string WKT
{ {