XAML-Map-Control/MapProjections/Shared/WorldMercatorProjection.cs

38 lines
1.3 KiB
C#
Raw Normal View History

2026-01-13 23:24:48 +01:00
#if WPF
using System.Windows.Media;
#endif
2018-12-20 21:55:12 +01:00
namespace MapControl.Projections
{
/// <summary>
2026-01-15 11:04:11 +01:00
/// Elliptical Mercator Projection implemented by setting the WKT property of a ProjNetMapProjection.
2018-12-20 21:55:12 +01:00
/// See "Map Projections - A Working Manual" (https://pubs.usgs.gov/pp/1395/report.pdf), p.44-45.
/// </summary>
2026-01-15 11:04:11 +01:00
public class WorldMercatorProjection : ProjNetMapProjection
2018-12-20 21:55:12 +01:00
{
public WorldMercatorProjection()
{
2026-01-16 20:22:45 +01:00
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\"]]";
2018-12-20 21:55:12 +01:00
}
public override Matrix RelativeScale(double latitude, double longitude)
2018-12-20 21:55:12 +01:00
{
2026-01-15 11:04:11 +01:00
var k = MapControl.WorldMercatorProjection.RelativeScale(latitude);
2018-12-20 21:55:12 +01:00
return new Matrix(k, 0d, 0d, k, 0d, 0d);
2018-12-20 21:55:12 +01:00
}
}
}