Updated projections

This commit is contained in:
ClemensFischer 2026-01-13 23:24:48 +01:00
parent da3a9a18fb
commit 91dfeee19c
6 changed files with 49 additions and 43 deletions

View file

@ -241,7 +241,7 @@ namespace MapControl.Projections
{
MapControl.WebMercatorProjection.DefaultCrsId => new WebMercatorProjection(),
MapControl.WorldMercatorProjection.DefaultCrsId => new WorldMercatorProjection(),
MapControl.Wgs84AutoUtmProjection.DefaultCrsId => new Wgs84AutoUtmProjection(),
Wgs84AutoUtmProjection.DefaultCrsId => new Wgs84AutoUtmProjection(),
_ => base.GetProjection(crsId)
};

View file

@ -9,10 +9,12 @@ namespace MapControl.Projections
/// </summary>
public class Wgs84AutoUtmProjection : Wgs84UtmProjection
{
public const string DefaultCrsId = "AUTO2:42001";
private readonly string autoCrsId;
public Wgs84AutoUtmProjection() // parameterless constructor for XAML
: this(MapControl.Wgs84AutoUtmProjection.DefaultCrsId)
: this(DefaultCrsId)
{
}

View file

@ -1,5 +1,4 @@
using System;
#if WPF
#if WPF
using System.Windows;
#elif AVALONIA
using Avalonia;
@ -36,9 +35,7 @@ namespace MapControl.Projections
public override Point RelativeScale(double latitude, double longitude)
{
var lat = latitude * Math.PI / 180d;
var eSinLat = MapControl.WorldMercatorProjection.Wgs84Eccentricity * Math.Sin(lat);
var k = Math.Sqrt(1d - eSinLat * eSinLat) / Math.Cos(lat); // p.44 (7-8)
var k = MapControl.WorldMercatorProjection.ScaleFactor(latitude);
return new Point(k, k);
}