mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2026-04-05 14:37:01 +00:00
Unified map projections
This commit is contained in:
parent
a4bd11e26d
commit
9fe7dccd68
21 changed files with 370 additions and 377 deletions
|
|
@ -1,46 +0,0 @@
|
|||
using System;
|
||||
|
||||
namespace MapControl.Projections
|
||||
{
|
||||
/// <summary>
|
||||
/// ED50 Universal Transverse Mercator Projection.
|
||||
/// </summary>
|
||||
public class Ed50UtmProjection : ProjNetMapProjection
|
||||
{
|
||||
public const int FirstZone = 28;
|
||||
public const int LastZone = 38;
|
||||
public const int FirstZoneEpsgCode = 23000 + FirstZone;
|
||||
public const int LastZoneEpsgCode = 23000 + LastZone;
|
||||
|
||||
public int Zone { get; }
|
||||
|
||||
public Ed50UtmProjection(int zone)
|
||||
: base(new TransverseMercatorProjection
|
||||
{
|
||||
EquatorialRadius = 6378388d,
|
||||
Flattening = 297,
|
||||
CentralMeridian = 6 * zone - 183,
|
||||
})
|
||||
{
|
||||
if (zone < FirstZone || zone > LastZone)
|
||||
{
|
||||
throw new ArgumentException($"Invalid ED50 UTM zone {zone}.", nameof(zone));
|
||||
}
|
||||
|
||||
Zone = zone;
|
||||
CoordinateSystemWkt =
|
||||
$"PROJCS[\"ED50 / UTM zone {zone}N\"," +
|
||||
WktConstants.GeogCsEd50 + "," +
|
||||
"PROJECTION[\"Transverse_Mercator\"]," +
|
||||
"PARAMETER[\"latitude_of_origin\",0]," +
|
||||
$"PARAMETER[\"central_meridian\",{6 * zone - 183}]," +
|
||||
"PARAMETER[\"scale_factor\",0.9996]," +
|
||||
"PARAMETER[\"false_easting\",500000]," +
|
||||
"PARAMETER[\"false_northing\",0]," +
|
||||
"UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]]," +
|
||||
"AXIS[\"Easting\",EAST]," +
|
||||
"AXIS[\"Northing\",NORTH]," +
|
||||
$"AUTHORITY[\"EPSG\",\"230{zone:00}\"]]";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
namespace MapControl.Projections
|
||||
{
|
||||
/// <summary>
|
||||
/// ETRS89 Universal Transverse Mercator Projection - EPSG:25828 to EPSG:25838.
|
||||
/// </summary>
|
||||
public class Etrs89UtmProjection : ProjNetMapProjection
|
||||
{
|
||||
public int Zone { get; }
|
||||
|
||||
public Etrs89UtmProjection(int zone)
|
||||
: base(new MapControl.Etrs89UtmProjection(zone))
|
||||
{
|
||||
Zone = zone;
|
||||
CoordinateSystemWkt =
|
||||
$"PROJCS[\"ETRS89 / UTM zone {zone}N\"," +
|
||||
WktConstants.GeogCsEtrs89 + "," +
|
||||
"PROJECTION[\"Transverse_Mercator\"]," +
|
||||
"PARAMETER[\"latitude_of_origin\",0]," +
|
||||
$"PARAMETER[\"central_meridian\",{6 * zone - 183}]," +
|
||||
"PARAMETER[\"scale_factor\",0.9996]," +
|
||||
"PARAMETER[\"false_easting\",500000]," +
|
||||
"PARAMETER[\"false_northing\",0]," +
|
||||
"UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]]," +
|
||||
"AXIS[\"Easting\",EAST]," +
|
||||
"AXIS[\"Northing\",NORTH]," +
|
||||
$"AUTHORITY[\"EPSG\",\"258{zone:00}\"]]";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
namespace MapControl.Projections
|
||||
{
|
||||
/// <summary>
|
||||
/// NAD27 Universal Transverse Mercator Projection - EPSG:26701 to EPSG:26722.
|
||||
/// </summary>
|
||||
public class Nad27UtmProjection : ProjNetMapProjection
|
||||
{
|
||||
public int Zone { get; }
|
||||
|
||||
public Nad27UtmProjection(int zone)
|
||||
: base(new MapControl.Nad27UtmProjection(zone))
|
||||
{
|
||||
Zone = zone;
|
||||
CoordinateSystemWkt =
|
||||
$"PROJCS[\"NAD27 / UTM zone {zone}N\"," +
|
||||
WktConstants.GeogCsNad27 + "," +
|
||||
"PROJECTION[\"Transverse_Mercator\"]," +
|
||||
"PARAMETER[\"latitude_of_origin\",0]," +
|
||||
$"PARAMETER[\"central_meridian\",{6 * zone - 183}]," +
|
||||
"PARAMETER[\"scale_factor\",0.9996]," +
|
||||
"PARAMETER[\"false_easting\",500000]," +
|
||||
"PARAMETER[\"false_northing\",0]," +
|
||||
"UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]]," +
|
||||
"AXIS[\"Easting\",EAST]," +
|
||||
"AXIS[\"Northing\",NORTH]," +
|
||||
$"AUTHORITY[\"EPSG\",\"267{zone:00}\"]]";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
namespace MapControl.Projections
|
||||
{
|
||||
/// <summary>
|
||||
/// NAD83 Universal Transverse Mercator Projection - EPSG:26901 to EPSG:26923.
|
||||
/// </summary>
|
||||
public class Nad83UtmProjection : ProjNetMapProjection
|
||||
{
|
||||
public int Zone { get; }
|
||||
|
||||
public Nad83UtmProjection(int zone)
|
||||
: base(new MapControl.Nad83UtmProjection(zone))
|
||||
{
|
||||
Zone = zone;
|
||||
CoordinateSystemWkt =
|
||||
$"PROJCS[\"NAD83 / UTM zone {zone}N\"," +
|
||||
WktConstants.GeogCsNad83 + "," +
|
||||
"PROJECTION[\"Transverse_Mercator\"]," +
|
||||
"PARAMETER[\"latitude_of_origin\",0]," +
|
||||
$"PARAMETER[\"central_meridian\",{6 * zone - 183}]," +
|
||||
"PARAMETER[\"scale_factor\",0.9996]," +
|
||||
"PARAMETER[\"false_easting\",500000]," +
|
||||
"PARAMETER[\"false_northing\",0]," +
|
||||
"UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]]," +
|
||||
"AXIS[\"Easting\",EAST]," +
|
||||
"AXIS[\"Northing\",NORTH]," +
|
||||
$"AUTHORITY[\"EPSG\",\"269{zone:00}\"]]";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -15,11 +15,9 @@ namespace MapControl.Projections
|
|||
/// </summary>
|
||||
public class ProjNetMapProjection : MapProjection
|
||||
{
|
||||
protected MapProjection FallbackProjection { get; private set; }
|
||||
|
||||
protected ProjNetMapProjection(MapProjection fallbackProjection)
|
||||
public ProjNetMapProjection(ProjectedCoordinateSystem coordinateSystem)
|
||||
{
|
||||
FallbackProjection = fallbackProjection;
|
||||
CoordinateSystem = coordinateSystem;
|
||||
}
|
||||
|
||||
public ProjNetMapProjection(string coordinateSystemWkt)
|
||||
|
|
@ -52,7 +50,9 @@ namespace MapControl.Projections
|
|||
var projection = field.Projection ??
|
||||
throw new ArgumentException("CoordinateSystem.Projection must not be null.", nameof(value));
|
||||
|
||||
var ellipsoid = field.GeographicCoordinateSystem.HorizontalDatum.Ellipsoid;
|
||||
IsNormalCylindrical = projection.Name.Contains("Pseudo-Mercator") ||
|
||||
projection.Name.StartsWith("Mercator");
|
||||
|
||||
var transformFactory = new CoordinateTransformationFactory();
|
||||
|
||||
CrsId = !string.IsNullOrEmpty(field.Authority) && field.AuthorityCode > 0
|
||||
|
|
@ -67,47 +67,24 @@ namespace MapControl.Projections
|
|||
.CreateFromCoordinateSystems(field, GeographicCoordinateSystem.WGS84)
|
||||
.MathTransform;
|
||||
|
||||
if (projection.Name.Contains("Pseudo-Mercator"))
|
||||
{
|
||||
IsNormalCylindrical = true;
|
||||
FallbackProjection = new MapControl.WebMercatorProjection
|
||||
{
|
||||
EquatorialRadius = ellipsoid.SemiMajorAxis
|
||||
};
|
||||
}
|
||||
else if (projection.Name.StartsWith("Mercator"))
|
||||
{
|
||||
IsNormalCylindrical = true;
|
||||
FallbackProjection = new MapControl.WorldMercatorProjection
|
||||
{
|
||||
EquatorialRadius = ellipsoid.SemiMajorAxis,
|
||||
Flattening = 1d / ellipsoid.InverseFlattening
|
||||
};
|
||||
}
|
||||
else if (projection.Name.StartsWith("Transverse_Mercator"))
|
||||
{
|
||||
FallbackProjection = new TransverseMercatorProjection
|
||||
{
|
||||
EquatorialRadius = ellipsoid.SemiMajorAxis,
|
||||
Flattening = 1d / ellipsoid.InverseFlattening,
|
||||
CentralMeridian = projection.GetParameter("central_meridian").Value,
|
||||
ScaleFactor = projection.GetParameter("scale_factor").Value,
|
||||
FalseEasting = projection.GetParameter("false_easting").Value,
|
||||
FalseNorthing = projection.GetParameter("false_northing").Value
|
||||
};
|
||||
}
|
||||
else if (projection.Name.StartsWith("Polar_Stereographic"))
|
||||
{
|
||||
FallbackProjection = new PolarStereographicProjection
|
||||
{
|
||||
EquatorialRadius = ellipsoid.SemiMajorAxis,
|
||||
Flattening = 1d / ellipsoid.InverseFlattening,
|
||||
ScaleFactor = projection.GetParameter("scale_factor").Value,
|
||||
FalseEasting = projection.GetParameter("false_easting").Value,
|
||||
FalseNorthing = projection.GetParameter("false_northing").Value,
|
||||
LatitudeOfOrigin = projection.GetParameter("latitude_of_origin").Value
|
||||
};
|
||||
}
|
||||
var ellipsoid = field.HorizontalDatum.Ellipsoid;
|
||||
EquatorialRadius = ellipsoid.SemiMajorAxis;
|
||||
Flattening = 1d / ellipsoid.InverseFlattening;
|
||||
|
||||
var parameter = projection.GetParameter("scale_factor");
|
||||
ScaleFactor = parameter != null ? parameter.Value : 1d;
|
||||
|
||||
parameter = projection.GetParameter("central_meridian");
|
||||
CentralMeridian = parameter != null ? parameter.Value : 0d;
|
||||
|
||||
parameter = projection.GetParameter("latitude_of_origin");
|
||||
LatitudeOfOrigin = parameter != null ? parameter.Value : 0d;
|
||||
|
||||
parameter = projection.GetParameter("false_easting");
|
||||
FalseEasting = parameter != null ? parameter.Value : 0d;
|
||||
|
||||
parameter = projection.GetParameter("false_northing");
|
||||
FalseNorthing = parameter != null ? parameter.Value : 0d;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -139,18 +116,91 @@ namespace MapControl.Projections
|
|||
return new Location(coordinate[1], coordinate[0]);
|
||||
}
|
||||
|
||||
public override Matrix RelativeTransform(double latitude, double longitude)
|
||||
public override double GridConvergence(double latitude, double longitude)
|
||||
{
|
||||
return FallbackProjection != null
|
||||
? FallbackProjection.RelativeTransform(latitude, longitude)
|
||||
: new Matrix(1d, 0d, 0d, 1d, 0d, 0d);
|
||||
var projection = CoordinateSystem.Projection.Name;
|
||||
|
||||
if (projection.StartsWith("Transverse_Mercator"))
|
||||
{
|
||||
return TransverseMercatorGridConvergence(latitude, longitude);
|
||||
}
|
||||
|
||||
if (projection.StartsWith("Polar_Stereographic"))
|
||||
{
|
||||
return PolarStereographicGridConvergence(longitude);
|
||||
}
|
||||
|
||||
return base.GridConvergence(latitude, longitude);
|
||||
}
|
||||
|
||||
public override double GridConvergence(double x, double y)
|
||||
public override Matrix RelativeTransform(double latitude, double longitude)
|
||||
{
|
||||
return FallbackProjection != null
|
||||
? FallbackProjection.GridConvergence(x, y)
|
||||
: 0d;
|
||||
var projection = CoordinateSystem.Projection.Name;
|
||||
|
||||
if (projection.Contains("Pseudo-Mercator"))
|
||||
{
|
||||
return WebMercatorRelativeTransform(latitude);
|
||||
}
|
||||
|
||||
if (projection.StartsWith("Mercator"))
|
||||
{
|
||||
return WorldMercatorRelativeTransform(latitude);
|
||||
}
|
||||
|
||||
if (projection.StartsWith("Polar_Stereographic"))
|
||||
{
|
||||
return PolarStereographicRelativeTransform(latitude, longitude);
|
||||
}
|
||||
|
||||
return base.RelativeTransform(latitude, longitude);
|
||||
}
|
||||
|
||||
protected static Matrix WebMercatorRelativeTransform(double latitude)
|
||||
{
|
||||
var k = 1d / Math.Cos(latitude * Math.PI / 180d); // p.44 (7-3)
|
||||
|
||||
return new Matrix(k, 0d, 0d, k, 0d, 0d);
|
||||
}
|
||||
|
||||
protected Matrix WorldMercatorRelativeTransform(double latitude)
|
||||
{
|
||||
var e2 = (2d - Flattening) * Flattening;
|
||||
var phi = latitude * Math.PI / 180d;
|
||||
var sinPhi = Math.Sin(phi);
|
||||
var k = Math.Sqrt(1d - e2 * sinPhi * sinPhi) / Math.Cos(phi); // p.44 (7-8)
|
||||
|
||||
return new Matrix(k, 0d, 0d, k, 0d, 0d);
|
||||
}
|
||||
|
||||
protected double TransverseMercatorGridConvergence(double latitude, double longitude)
|
||||
{
|
||||
return 180d / Math.PI * Math.Atan(
|
||||
Math.Tan((longitude - CentralMeridian) * Math.PI / 180d) *
|
||||
Math.Sin(latitude * Math.PI / 180d));
|
||||
}
|
||||
|
||||
protected double PolarStereographicGridConvergence(double longitude)
|
||||
{
|
||||
return Math.Sign(LatitudeOfOrigin) * (longitude - CentralMeridian);
|
||||
}
|
||||
|
||||
protected Matrix PolarStereographicRelativeTransform(double latitude, double longitude)
|
||||
{
|
||||
var sign = Math.Sign(LatitudeOfOrigin);
|
||||
var phi = sign * latitude * Math.PI / 180d;
|
||||
var e = Math.Sqrt((2d - Flattening) * Flattening);
|
||||
var eSinPhi = e * Math.Sin(phi);
|
||||
var t = Math.Tan(Math.PI / 4d - phi / 2d)
|
||||
/ Math.Pow((1d - eSinPhi) / (1d + eSinPhi), e / 2d); // p.161 (15-9)
|
||||
// r == ρ/a
|
||||
var r = 2d * ScaleFactor * t / Math.Sqrt(Math.Pow(1d + e, 1d + e) * Math.Pow(1d - e, 1d - e)); // p.161 (21-33)
|
||||
var m = Math.Cos(phi) / Math.Sqrt(1d - eSinPhi * eSinPhi); // p.160 (14-15)
|
||||
var k = r / m; // p.161 (21-32)
|
||||
|
||||
var transform = new Matrix(k, 0d, 0d, k, 0d, 0d);
|
||||
transform.Rotate(-sign * (longitude - CentralMeridian));
|
||||
|
||||
return transform;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using System.Collections.Generic;
|
||||
using ProjNet.CoordinateSystems;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MapControl.Projections
|
||||
{
|
||||
|
|
@ -54,11 +55,175 @@ namespace MapControl.Projections
|
|||
var c when c is >= MapControl.Nad83UtmProjection.FirstZoneEpsgCode
|
||||
and <= MapControl.Nad83UtmProjection.LastZoneEpsgCode => new Nad83UtmProjection(c % 100),
|
||||
var c when c is >= MapControl.Wgs84UtmProjection.FirstZoneNorthEpsgCode
|
||||
and <= MapControl.Wgs84UtmProjection.LastZoneNorthEpsgCode => new Wgs84UtmProjection(c % 100, Hemisphere.North),
|
||||
and <= MapControl.Wgs84UtmProjection.LastZoneNorthEpsgCode => new Wgs84UtmProjection(c % 100, true),
|
||||
var c when c is >= MapControl.Wgs84UtmProjection.FirstZoneSouthEpsgCode
|
||||
and <= MapControl.Wgs84UtmProjection.LastZoneSouthEpsgCode => new Wgs84UtmProjection(c % 100, Hemisphere.South),
|
||||
and <= MapControl.Wgs84UtmProjection.LastZoneSouthEpsgCode => new Wgs84UtmProjection(c % 100, false),
|
||||
_ => base.CreateProjection(epsgCode)
|
||||
};
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Spherical Mercator Projection - EPSG:3857,
|
||||
/// implemented by setting the CoordinateSystem property of a ProjNetMapProjection.
|
||||
/// See "Map Projections - A Working Manual" (https://pubs.usgs.gov/pp/1395/report.pdf), p.41-44.
|
||||
/// </summary>
|
||||
public class WebMercatorProjection : ProjNetMapProjection
|
||||
{
|
||||
public WebMercatorProjection()
|
||||
: base(ProjectedCoordinateSystem.WebMercator)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elliptical Mercator Projection - EPSG:3395,
|
||||
/// implemented by setting the CoordinateSystemWkt property of a ProjNetMapProjection.
|
||||
/// See "Map Projections - A Working Manual" (https://pubs.usgs.gov/pp/1395/report.pdf), p.44-45.
|
||||
/// </summary>
|
||||
public class WorldMercatorProjection : ProjNetMapProjection
|
||||
{
|
||||
public WorldMercatorProjection() : base(
|
||||
"PROJCS[\"WGS 84 / World Mercator\"," +
|
||||
WktConstants.GeogCsWgs84 + "," +
|
||||
"PROJECTION[\"Mercator_1SP\"]," +
|
||||
"PARAMETER[\"latitude_of_origin\",0]," +
|
||||
"PARAMETER[\"central_meridian\",0]," +
|
||||
"PARAMETER[\"scale_factor\",1]," +
|
||||
"PARAMETER[\"false_easting\",0]," +
|
||||
"PARAMETER[\"false_northing\",0]," +
|
||||
"UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]]," +
|
||||
"AXIS[\"Easting\",EAST]," +
|
||||
"AXIS[\"Northing\",NORTH]," +
|
||||
"AUTHORITY[\"EPSG\",\"3395\"]]")
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// WGS84 Universal Transverse Mercator Projection -
|
||||
/// EPSG:32601 to EPSG:32660 and EPSG:32701 to EPSG:32760.
|
||||
/// </summary>
|
||||
public class Wgs84UtmProjection(int zone, bool north) : ProjNetMapProjection(
|
||||
ProjectedCoordinateSystem.WGS84_UTM(zone, north))
|
||||
{
|
||||
public int Zone => zone;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ETRS89 Universal Transverse Mercator Projection - EPSG:25828 to EPSG:25838.
|
||||
/// </summary>
|
||||
public class Etrs89UtmProjection(int zone) : ProjNetMapProjection(
|
||||
$"PROJCS[\"ETRS89 / UTM zone {zone}N\"," +
|
||||
WktConstants.GeogCsEtrs89 + "," +
|
||||
"PROJECTION[\"Transverse_Mercator\"]," +
|
||||
"PARAMETER[\"latitude_of_origin\",0]," +
|
||||
$"PARAMETER[\"central_meridian\",{6 * zone - 183}]," +
|
||||
"PARAMETER[\"scale_factor\",0.9996]," +
|
||||
"PARAMETER[\"false_easting\",500000]," +
|
||||
"PARAMETER[\"false_northing\",0]," +
|
||||
"UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]]," +
|
||||
"AXIS[\"Easting\",EAST]," +
|
||||
"AXIS[\"Northing\",NORTH]," +
|
||||
$"AUTHORITY[\"EPSG\",\"258{zone:00}\"]]")
|
||||
{
|
||||
public int Zone => zone;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// NAD27 Universal Transverse Mercator Projection - EPSG:26701 to EPSG:26722.
|
||||
/// </summary>
|
||||
public class Nad27UtmProjection(int zone) : ProjNetMapProjection(
|
||||
$"PROJCS[\"NAD27 / UTM zone {zone}N\"," +
|
||||
WktConstants.GeogCsNad27 + "," +
|
||||
"PROJECTION[\"Transverse_Mercator\"]," +
|
||||
"PARAMETER[\"latitude_of_origin\",0]," +
|
||||
$"PARAMETER[\"central_meridian\",{6 * zone - 183}]," +
|
||||
"PARAMETER[\"scale_factor\",0.9996]," +
|
||||
"PARAMETER[\"false_easting\",500000]," +
|
||||
"PARAMETER[\"false_northing\",0]," +
|
||||
"UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]]," +
|
||||
"AXIS[\"Easting\",EAST]," +
|
||||
"AXIS[\"Northing\",NORTH]," +
|
||||
$"AUTHORITY[\"EPSG\",\"267{zone:00}\"]]")
|
||||
{
|
||||
public int Zone => zone;
|
||||
}
|
||||
/// <summary>
|
||||
/// NAD83 Universal Transverse Mercator Projection - EPSG:26901 to EPSG:26923.
|
||||
/// </summary>
|
||||
public class Nad83UtmProjection(int zone) : ProjNetMapProjection(
|
||||
$"PROJCS[\"NAD83 / UTM zone {zone}N\"," +
|
||||
WktConstants.GeogCsNad83 + "," +
|
||||
"PROJECTION[\"Transverse_Mercator\"]," +
|
||||
"PARAMETER[\"latitude_of_origin\",0]," +
|
||||
$"PARAMETER[\"central_meridian\",{6 * zone - 183}]," +
|
||||
"PARAMETER[\"scale_factor\",0.9996]," +
|
||||
"PARAMETER[\"false_easting\",500000]," +
|
||||
"PARAMETER[\"false_northing\",0]," +
|
||||
"UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]]," +
|
||||
"AXIS[\"Easting\",EAST]," +
|
||||
"AXIS[\"Northing\",NORTH]," +
|
||||
$"AUTHORITY[\"EPSG\",\"269{zone:00}\"]]")
|
||||
{
|
||||
public int Zone => zone;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ED50 Universal Transverse Mercator Projection.
|
||||
/// </summary>
|
||||
public class Ed50UtmProjection(int zone) : ProjNetMapProjection(
|
||||
$"PROJCS[\"ED50 / UTM zone {zone}N\"," +
|
||||
WktConstants.GeogCsEd50 + "," +
|
||||
"PROJECTION[\"Transverse_Mercator\"]," +
|
||||
"PARAMETER[\"latitude_of_origin\",0]," +
|
||||
$"PARAMETER[\"central_meridian\",{6 * zone - 183}]," +
|
||||
"PARAMETER[\"scale_factor\",0.9996]," +
|
||||
"PARAMETER[\"false_easting\",500000]," +
|
||||
"PARAMETER[\"false_northing\",0]," +
|
||||
"UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]]," +
|
||||
"AXIS[\"Easting\",EAST]," +
|
||||
"AXIS[\"Northing\",NORTH]," +
|
||||
$"AUTHORITY[\"EPSG\",\"230{zone:00}\"]]")
|
||||
{
|
||||
public const int FirstZone = 28;
|
||||
public const int LastZone = 38;
|
||||
public const int FirstZoneEpsgCode = 23000 + FirstZone;
|
||||
public const int LastZoneEpsgCode = 23000 + LastZone;
|
||||
|
||||
public int Zone { get; } = zone;
|
||||
}
|
||||
|
||||
public class Wgs84UpsNorthProjection : ProjNetMapProjection
|
||||
{
|
||||
public Wgs84UpsNorthProjection() : base(
|
||||
"PROJCS[\"WGS 84 / UPS North (N,E)\"," +
|
||||
WktConstants.GeogCsWgs84 + "," +
|
||||
"PROJECTION[\"Polar_Stereographic\"]," +
|
||||
"PARAMETER[\"latitude_of_origin\",90]," +
|
||||
"PARAMETER[\"central_meridian\",0]," +
|
||||
"PARAMETER[\"scale_factor\",0.994]," +
|
||||
"PARAMETER[\"false_easting\",2000000]," +
|
||||
"PARAMETER[\"false_northing\",2000000]," +
|
||||
"UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]]," +
|
||||
"AUTHORITY[\"EPSG\",\"32661\"]]")
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public class Wgs84UpsSouthProjection : ProjNetMapProjection
|
||||
{
|
||||
public Wgs84UpsSouthProjection() : base(
|
||||
"PROJCS[\"WGS 84 / UPS South (N,E)\"," +
|
||||
WktConstants.GeogCsWgs84 + "," +
|
||||
"PROJECTION[\"Polar_Stereographic\"]," +
|
||||
"PARAMETER[\"latitude_of_origin\",-90]," +
|
||||
"PARAMETER[\"central_meridian\",0]," +
|
||||
"PARAMETER[\"scale_factor\",0.994]," +
|
||||
"PARAMETER[\"false_easting\",2000000]," +
|
||||
"PARAMETER[\"false_northing\",2000000]," +
|
||||
"UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]]," +
|
||||
"AUTHORITY[\"EPSG\",\"32761\"]]")
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,17 +0,0 @@
|
|||
using ProjNet.CoordinateSystems;
|
||||
|
||||
namespace MapControl.Projections
|
||||
{
|
||||
/// <summary>
|
||||
/// Spherical Mercator Projection implemented by setting the CoordinateSystem property of a ProjNetMapProjection.
|
||||
/// See "Map Projections - A Working Manual" (https://pubs.usgs.gov/pp/1395/report.pdf), p.41-44.
|
||||
/// </summary>
|
||||
public class WebMercatorProjection : ProjNetMapProjection
|
||||
{
|
||||
public WebMercatorProjection()
|
||||
: base(new MapControl.WebMercatorProjection())
|
||||
{
|
||||
CoordinateSystem = ProjectedCoordinateSystem.WebMercator;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,44 +0,0 @@
|
|||
#if WPF
|
||||
using System.Windows.Media;
|
||||
#endif
|
||||
|
||||
namespace MapControl.Projections
|
||||
{
|
||||
public class Wgs84UpsNorthProjection : ProjNetMapProjection
|
||||
{
|
||||
public Wgs84UpsNorthProjection()
|
||||
: base(new MapControl.Wgs84UpsNorthProjection())
|
||||
{
|
||||
CoordinateSystemWkt =
|
||||
"PROJCS[\"WGS 84 / UPS North (N,E)\"," +
|
||||
WktConstants.GeogCsWgs84 + "," +
|
||||
"PROJECTION[\"Polar_Stereographic\"]," +
|
||||
"PARAMETER[\"latitude_of_origin\",90]," +
|
||||
"PARAMETER[\"central_meridian\",0]," +
|
||||
"PARAMETER[\"scale_factor\",0.994]," +
|
||||
"PARAMETER[\"false_easting\",2000000]," +
|
||||
"PARAMETER[\"false_northing\",2000000]," +
|
||||
"UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]]," +
|
||||
"AUTHORITY[\"EPSG\",\"32661\"]]";
|
||||
}
|
||||
}
|
||||
|
||||
public class Wgs84UpsSouthProjection : ProjNetMapProjection
|
||||
{
|
||||
public Wgs84UpsSouthProjection()
|
||||
: base(new MapControl.Wgs84UpsSouthProjection())
|
||||
{
|
||||
CoordinateSystemWkt =
|
||||
"PROJCS[\"WGS 84 / UPS South (N,E)\"," +
|
||||
WktConstants.GeogCsWgs84 + "," +
|
||||
"PROJECTION[\"Polar_Stereographic\"]," +
|
||||
"PARAMETER[\"latitude_of_origin\",-90]," +
|
||||
"PARAMETER[\"central_meridian\",0]," +
|
||||
"PARAMETER[\"scale_factor\",0.994]," +
|
||||
"PARAMETER[\"false_easting\",2000000]," +
|
||||
"PARAMETER[\"false_northing\",2000000]," +
|
||||
"UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]]," +
|
||||
"AUTHORITY[\"EPSG\",\"32761\"]]";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
using ProjNet.CoordinateSystems;
|
||||
|
||||
namespace MapControl.Projections
|
||||
{
|
||||
/// <summary>
|
||||
/// WGS84 Universal Transverse Mercator Projection -
|
||||
/// EPSG:32601 to EPSG:32660 and EPSG:32701 to EPSG:32760.
|
||||
/// </summary>
|
||||
public class Wgs84UtmProjection : ProjNetMapProjection
|
||||
{
|
||||
public int Zone { get; }
|
||||
public Hemisphere Hemisphere { get; }
|
||||
|
||||
public Wgs84UtmProjection(int zone, Hemisphere hemisphere)
|
||||
: base(new MapControl.Wgs84UtmProjection(zone, hemisphere))
|
||||
{
|
||||
Zone = zone;
|
||||
Hemisphere = hemisphere;
|
||||
CoordinateSystem = ProjectedCoordinateSystem.WGS84_UTM(zone, hemisphere == Hemisphere.North);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
namespace MapControl.Projections
|
||||
{
|
||||
/// <summary>
|
||||
/// Elliptical Mercator Projection implemented by setting the WKT property of a ProjNetMapProjection.
|
||||
/// See "Map Projections - A Working Manual" (https://pubs.usgs.gov/pp/1395/report.pdf), p.44-45.
|
||||
/// </summary>
|
||||
public class WorldMercatorProjection : ProjNetMapProjection
|
||||
{
|
||||
public WorldMercatorProjection()
|
||||
: base(new MapControl.WorldMercatorProjection())
|
||||
{
|
||||
CoordinateSystemWkt =
|
||||
"PROJCS[\"WGS 84 / World Mercator\"," +
|
||||
WktConstants.GeogCsWgs84 + "," +
|
||||
"PROJECTION[\"Mercator_1SP\"]," +
|
||||
"PARAMETER[\"latitude_of_origin\",0]," +
|
||||
"PARAMETER[\"central_meridian\",0]," +
|
||||
"PARAMETER[\"scale_factor\",1]," +
|
||||
"PARAMETER[\"false_easting\",0]," +
|
||||
"PARAMETER[\"false_northing\",0]," +
|
||||
"UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]]," +
|
||||
"AXIS[\"Easting\",EAST]," +
|
||||
"AXIS[\"Northing\",NORTH]," +
|
||||
"AUTHORITY[\"EPSG\",\"3395\"]]";
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue