Added Nad27UtmProjection

This commit is contained in:
ClemensFischer 2024-09-11 23:36:21 +02:00
parent c3ceb143d3
commit 58ff91ee09
3 changed files with 46 additions and 0 deletions

View file

@ -67,6 +67,9 @@ namespace MapControl
case var c when c >= Etrs89UtmProjection.FirstZoneEpsgCode && c <= Etrs89UtmProjection.LastZoneEpsgCode:
return new Etrs89UtmProjection(epsgCode % 100);
case var c when c >= Nad27UtmProjection.FirstZoneEpsgCode && c <= Nad27UtmProjection.LastZoneEpsgCode:
return new Nad27UtmProjection(epsgCode % 100);
case var c when c >= Nad83UtmProjection.FirstZoneEpsgCode && c <= Nad83UtmProjection.LastZoneEpsgCode:
return new Nad83UtmProjection(epsgCode % 100);

View file

@ -0,0 +1,40 @@
// XAML Map Control - https://github.com/ClemensFischer/XAML-Map-Control
// Copyright © 2024 Clemens Fischer
// Licensed under the Microsoft Public License (Ms-PL)
using System;
namespace MapControl
{
/// <summary>
/// NAD27 UTM Projection with zone number.
/// </summary>
public class Nad27UtmProjection : TransverseMercatorProjection
{
public const int FirstZone = 1;
public const int LastZone = 22;
public const int FirstZoneEpsgCode = 26700 + FirstZone;
public const int LastZoneEpsgCode = 26700 + LastZone;
public int Zone { get; }
public Nad27UtmProjection(int zone)
{
if (zone < FirstZone || zone > LastZone)
{
throw new ArgumentException($"Invalid NAD27 UTM zone {zone}.", nameof(zone));
}
Zone = zone;
CrsId = $"EPSG:{26700 + Zone}";
// Clarke 1866
EquatorialRadius = 6378206.4;
Flattening = 1d / 294.978698213898;
ScaleFactor = 0.9996;
CentralMeridian = Zone * 6d - 183d;
FalseEasting = 5e5;
FalseNorthing = 0d;
}
}
}

View file

@ -143,6 +143,9 @@
<Compile Include="..\Shared\MapTileLayerBase.cs">
<Link>MapTileLayerBase.cs</Link>
</Compile>
<Compile Include="..\Shared\Nad27UtmProjection.cs">
<Link>Nad27UtmProjection.cs</Link>
</Compile>
<Compile Include="..\Shared\Nad83UtmProjection.cs">
<Link>Nad83UtmProjection.cs</Link>
</Compile>