2026-01-13 23:24:48 +01:00
|
|
|
|
#if WPF
|
2024-05-19 17:24:18 +02:00
|
|
|
|
using System.Windows;
|
2024-05-27 17:30:58 +02:00
|
|
|
|
#elif AVALONIA
|
|
|
|
|
|
using Avalonia;
|
2024-05-19 17:24:18 +02:00
|
|
|
|
#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()
|
|
|
|
|
|
{
|
2022-01-24 20:43:22 +01:00
|
|
|
|
CoordinateSystemWkt
|
|
|
|
|
|
= "PROJCS[\"WGS 84 / World Mercator\","
|
2026-01-16 09:45:48 +01:00
|
|
|
|
+ WktConstants.GeogCsWgs84 + ","
|
2022-01-21 00:17:01 +01:00
|
|
|
|
+ "PROJECTION[\"Mercator_1SP\"],"
|
|
|
|
|
|
+ "PARAMETER[\"latitude_of_origin\",0],"
|
|
|
|
|
|
+ "PARAMETER[\"central_meridian\",0],"
|
|
|
|
|
|
+ "PARAMETER[\"scale_factor\",1],"
|
|
|
|
|
|
+ "PARAMETER[\"false_easting\",0],"
|
|
|
|
|
|
+ "PARAMETER[\"false_northing\",0],"
|
2026-01-15 21:48:53 +01:00
|
|
|
|
+ "UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]],"
|
|
|
|
|
|
+ "AXIS[\"Easting\",EAST],"
|
|
|
|
|
|
+ "AXIS[\"Northing\",NORTH],"
|
2024-07-12 14:14:42 +02:00
|
|
|
|
+ "AUTHORITY[\"EPSG\",\"3395\"]]";
|
2018-12-20 21:55:12 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-01-06 11:56:28 +01:00
|
|
|
|
public override Point 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
|
|
|
|
|
2024-05-19 17:24:18 +02:00
|
|
|
|
return new Point(k, k);
|
2018-12-20 21:55:12 +01:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|