XAML-Map-Control/MapControl/Shared/Wgs84UtmProjection.cs

33 lines
1 KiB
C#
Raw Normal View History

2025-02-27 18:46:32 +01:00
using System;
namespace MapControl
{
/// <summary>
2026-01-23 11:26:49 +01:00
/// WGS84 Universal Transverse Mercator Projection -
/// EPSG:32601 to EPSG:32660 and EPSG:32701 to EPSG:32760.
/// </summary>
public class Wgs84UtmProjection : TransverseMercatorProjection
{
public const int FirstZone = 1;
public const int LastZone = 60;
public const int FirstZoneNorthEpsgCode = 32600 + FirstZone;
public const int LastZoneNorthEpsgCode = 32600 + LastZone;
public const int FirstZoneSouthEpsgCode = 32700 + FirstZone;
public const int LastZoneSouthEpsgCode = 32700 + LastZone;
public int Zone { get; }
2026-02-01 17:25:04 +01:00
public Wgs84UtmProjection(int zone, bool north) : base(zone)
{
if (zone < FirstZone || zone > LastZone)
{
throw new ArgumentException($"Invalid WGS84 UTM zone {zone}.", nameof(zone));
}
Zone = zone;
2026-02-01 17:25:04 +01:00
CrsId = $"EPSG:{(north ? 32600 : 32700) + zone}";
FalseNorthing = north ? 0d : 1e7;
}
}
}