XAML-Map-Control/MapProjections/Shared/Nad27UtmProjection.cs

46 lines
1.7 KiB
C#
Raw Normal View History

2025-02-27 18:46:32 +01:00
using System;
2022-12-14 18:02:19 +01:00
namespace MapControl.Projections
{
/// <summary>
2026-01-10 08:28:10 +01:00
/// NAD27 Universal Transverse Mercator Projection.
2022-12-14 18:02:19 +01:00
/// </summary>
public class Nad27UtmProjection : GeoApiProjection
{
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;
CoordinateSystemWkt
= $"PROJCS[\"NAD27 / UTM zone {zone}N\","
+ "GEOGCS[\"NAD27\","
+ "DATUM[\"North_American_Datum_1927\","
2024-09-12 00:01:28 +02:00
+ "SPHEROID[\"Clarke 1866\",6378206.4,294.978698213898]],"
2026-01-13 19:23:41 +01:00
+ GeoApiProjectionFactory.PrimeMeridianGreenwich + ","
2026-01-13 10:41:04 +01:00
+ GeoApiProjectionFactory.UnitDegree + ","
2022-12-14 18:02:19 +01:00
+ "AUTHORITY[\"EPSG\",\"4267\"]],"
2026-01-13 19:23:41 +01:00
+ GeoApiProjectionFactory.ProjectionTransverseMercator + ","
2022-12-14 18:02:19 +01:00
+ "PARAMETER[\"latitude_of_origin\",0],"
+ $"PARAMETER[\"central_meridian\",{6 * zone - 183}],"
+ "PARAMETER[\"scale_factor\",0.9996],"
+ "PARAMETER[\"false_easting\",500000],"
+ "PARAMETER[\"false_northing\",0],"
2026-01-13 10:41:04 +01:00
+ GeoApiProjectionFactory.UnitMeter + ","
2026-01-13 19:23:41 +01:00
+ GeoApiProjectionFactory.AxisEasting + ","
+ GeoApiProjectionFactory.AxisNorthing + ","
2024-09-11 23:55:47 +02:00
+ $"AUTHORITY[\"EPSG\",\"267{zone:00}\"]]";
2022-12-14 18:02:19 +01:00
}
}
}