Rotated relative scale in MapProjections

This commit is contained in:
ClemensFischer 2026-01-20 15:48:30 +01:00
parent 25d4e13c16
commit 3fbfb0d5c1
8 changed files with 85 additions and 41 deletions

View file

@ -1,7 +1,15 @@
using System.Globalization;
using System;
using System.Globalization;
#if WPF
using System.Windows.Media;
#endif
namespace MapControl.Projections
{
/// <summary>
/// Spherical Orthographic Projection - AUTO2:42003.
/// See "Map Projections - A Working Manual" (https://pubs.usgs.gov/publication/pp1395), p.148-150.
/// </summary>
public class Wgs84OrthographicProjection : ProjNetMapProjection
{
public Wgs84OrthographicProjection()
@ -25,5 +33,15 @@ namespace MapControl.Projections
CoordinateSystemWkt = string.Format(
CultureInfo.InvariantCulture, wktFormat, Center.Latitude, Center.Longitude);
}
public override Matrix RelativeScale(double latitude, double longitude)
{
var p = new AzimuthalProjection.ProjectedPoint(Center.Latitude, Center.Longitude, latitude, longitude);
var h = p.CosC; // p.149 (20-5)
var scale = new Matrix(h, 0d, 0d, 1d, 0d, 0d);
scale.Rotate(-Math.Atan2(p.Y, p.X) * 180d / Math.PI);
return scale;
}
}
}

View file

@ -1,7 +1,14 @@
using System.Globalization;
#if WPF
using System.Windows.Media;
#endif
namespace MapControl.Projections
{
/// <summary>
/// Spherical Stereographic Projection - AUTO2:97002.
/// See "Map Projections - A Working Manual" (https://pubs.usgs.gov/publication/pp1395), p.157-160.
/// </summary>
public class Wgs84StereographicProjection : ProjNetMapProjection
{
public Wgs84StereographicProjection()
@ -25,5 +32,13 @@ namespace MapControl.Projections
CoordinateSystemWkt = string.Format(
CultureInfo.InvariantCulture, wktFormat, Center.Latitude, Center.Longitude);
}
public override Matrix RelativeScale(double latitude, double longitude)
{
var p = new AzimuthalProjection.ProjectedPoint(Center.Latitude, Center.Longitude, latitude, longitude);
var k = 2d / (1d + p.CosC); // p.157 (21-4), k0 == 1
return new Matrix(k, 0d, 0d, k, 0d, 0d);
}
}
}