Updated map projections

This commit is contained in:
ClemensFischer 2026-02-04 16:53:15 +01:00
parent 53b82eadb6
commit cf3401d519
4 changed files with 22 additions and 51 deletions

View file

@ -15,14 +15,6 @@ namespace MapControl
/// </summary>
public class PolarStereographicProjection : MapProjection
{
public PolarStereographicProjection(bool north)
{
LatitudeOfOrigin = north ? 90d : -90d;
ScaleFactor = 0.994;
FalseEasting = 2e6;
FalseNorthing = 2e6;
}
public override double GridConvergence(double latitude, double longitude)
{
return Math.Sign(LatitudeOfOrigin) * (longitude - CentralMeridian);
@ -99,9 +91,13 @@ namespace MapControl
{
}
public Wgs84UpsNorthProjection(string crsId) : base(true)
public Wgs84UpsNorthProjection(string crsId)
{
CrsId = crsId;
ScaleFactor = 0.994;
LatitudeOfOrigin = 90d;
FalseEasting = 2e6;
FalseNorthing = 2e6;
}
}
@ -117,9 +113,13 @@ namespace MapControl
{
}
public Wgs84UpsSouthProjection(string crsId) : base(false)
public Wgs84UpsSouthProjection(string crsId)
{
CrsId = crsId;
ScaleFactor = 0.994;
LatitudeOfOrigin = -90d;
FalseEasting = 2e6;
FalseNorthing = 2e6;
}
}
}

View file

@ -29,17 +29,10 @@ namespace MapControl
private readonly double d3; // δ3
private readonly double A;
public TransverseMercatorProjection(
double equatorialRadius, double flattening,
double scaleFactor, double centralMeridian,
double falseEasting, double falseNorthing = 0d)
protected TransverseMercatorProjection(double equatorialRadius, double flattening)
{
EquatorialRadius = equatorialRadius;
Flattening = flattening;
ScaleFactor = scaleFactor;
CentralMeridian = centralMeridian;
FalseEasting = falseEasting;
FalseNorthing = falseNorthing;
n = flattening / (2d - flattening);
m = 2d * Math.Sqrt(n) / (1d + n);
@ -58,12 +51,14 @@ namespace MapControl
A = equatorialRadius / (1d + n) * (1d + n2 / 4d + n2 * n2 / 64d);
}
public TransverseMercatorProjection(
double equatorialRadius, double flattening,
double scaleFactor, int utmZone, bool north = true)
: this(equatorialRadius, flattening,
scaleFactor, utmZone * 6d - 183d, 5e5, north ? 0d : 1e7)
public TransverseMercatorProjection(string crsId, double equatorialRadius, double flattening, int utmZone, bool north = true)
: this(equatorialRadius, flattening)
{
CrsId = crsId;
ScaleFactor = 0.9996;
CentralMeridian = utmZone * 6d - 183d;
FalseEasting = 5e5;
FalseNorthing = north ? 0d : 1e7;
}
public override double GridConvergence(double latitude, double longitude)

View file

@ -15,26 +15,6 @@ namespace MapControl
/// </summary>
public class TransverseMercatorProjectionSnyder : MapProjection
{
public TransverseMercatorProjectionSnyder(
double equatorialRadius, double flattening, double scaleFactor,
double centralMeridian, double latitudeOfOrigin,
double falseEasting, double falseNorthing = 0d)
{
EquatorialRadius = equatorialRadius;
Flattening = flattening;
ScaleFactor = scaleFactor;
CentralMeridian = centralMeridian;
LatitudeOfOrigin = latitudeOfOrigin;
FalseEasting = falseEasting;
FalseNorthing = falseNorthing;
}
public TransverseMercatorProjectionSnyder(int utmZone, bool north = true)
: this(Wgs84EquatorialRadius, Wgs84Flattening,
0.9996, utmZone * 6d - 183d, 0d, 5e5, north ? 0d : 1e7)
{
}
public override double GridConvergence(double latitude, double longitude)
{
// φ

View file

@ -18,7 +18,7 @@ namespace MapControl
public int Zone { get; }
public Wgs84UtmProjection(int zone, bool north)
: base(Wgs84EquatorialRadius, Wgs84Flattening, 0.9996, zone, north)
: base($"EPSG:{(north ? 32600 : 32700) + zone}", Wgs84EquatorialRadius, Wgs84Flattening, zone, north)
{
if (zone < FirstZone || zone > LastZone)
{
@ -26,7 +26,6 @@ namespace MapControl
}
Zone = zone;
CrsId = $"EPSG:{(north ? 32600 : 32700) + zone}";
}
}
@ -43,7 +42,7 @@ namespace MapControl
public int Zone { get; }
public Etrs89UtmProjection(int zone)
: base(6378137d, 1d / 298.257222101, 0.9996, zone) // GRS 1980
: base($"EPSG:{25800 + zone}", 6378137d, 1d / 298.257222101, zone) // GRS 1980
{
if (zone < FirstZone || zone > LastZone)
{
@ -51,7 +50,6 @@ namespace MapControl
}
Zone = zone;
CrsId = $"EPSG:{25800 + zone}";
}
}
@ -68,7 +66,7 @@ namespace MapControl
public int Zone { get; }
public Nad83UtmProjection(int zone)
: base(6378137d, 1d / 298.257222101, 0.9996, zone) // GRS 1980
: base($"EPSG:{26900 + zone}", 6378137d, 1d / 298.257222101, zone) // GRS 1980
{
if (zone < FirstZone || zone > LastZone)
{
@ -76,7 +74,6 @@ namespace MapControl
}
Zone = zone;
CrsId = $"EPSG:{26900 + zone}";
}
}
@ -93,7 +90,7 @@ namespace MapControl
public int Zone { get; }
public Nad27UtmProjection(int zone)
: base(6378206.4, 1d / 294.978698213898, 0.9996, zone) // Clarke 1866
: base($"EPSG:{26700 + zone}", 6378206.4, 1d / 294.978698213898, zone) // Clarke 1866
{
if (zone < FirstZone || zone > LastZone)
{
@ -101,7 +98,6 @@ namespace MapControl
}
Zone = zone;
CrsId = $"EPSG:{26700 + zone}";
}
}
}