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

50 lines
1.9 KiB
C#
Raw Normal View History

2022-01-23 23:43:49 +01:00
// XAML Map Control - https://github.com/ClemensFischer/XAML-Map-Control
2025-01-01 18:57:55 +01:00
// Copyright © Clemens Fischer
2022-01-23 23:43:49 +01:00
// Licensed under the Microsoft Public License (Ms-PL)
using System;
namespace MapControl.Projections
{
2022-12-14 18:02:19 +01:00
/// <summary>
/// ED50 UTM Projection with zone number.
/// </summary>
2022-01-23 23:43:49 +01:00
public class Ed50UtmProjection : GeoApiProjection
{
2022-12-14 18:02:19 +01:00
public const int FirstZone = 28;
public const int LastZone = 38;
public const int FirstZoneEpsgCode = 23000 + FirstZone;
public const int LastZoneEpsgCode = 23000 + LastZone;
public int Zone { get; }
2022-01-23 23:43:49 +01:00
public Ed50UtmProjection(int zone)
{
2022-12-14 18:02:19 +01:00
if (zone < FirstZone || zone > LastZone)
2022-01-23 23:43:49 +01:00
{
2022-12-14 18:02:19 +01:00
throw new ArgumentException($"Invalid ED50 UTM zone {zone}.", nameof(zone));
2022-01-23 23:43:49 +01:00
}
2022-12-14 18:02:19 +01:00
Zone = zone;
CoordinateSystemWkt
= $"PROJCS[\"ED50 / UTM zone {zone}N\","
2022-01-23 23:43:49 +01:00
+ "GEOGCS[\"ED50\","
+ "DATUM[\"European_Datum_1950\","
2024-09-12 11:40:40 +02:00
+ "SPHEROID[\"International 1924\",6378388,297],TOWGS84[-87,-98,-121,0,0,0,0]],"
2022-12-14 18:02:19 +01:00
+ "PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],"
+ "UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9122\"]],"
2022-01-23 23:43:49 +01:00
+ "AUTHORITY[\"EPSG\",\"4230\"]],"
+ "PROJECTION[\"Transverse_Mercator\"],"
+ "PARAMETER[\"latitude_of_origin\",0],"
+ $"PARAMETER[\"central_meridian\",{6 * zone - 183}],"
2022-01-23 23:43:49 +01:00
+ "PARAMETER[\"scale_factor\",0.9996],"
+ "PARAMETER[\"false_easting\",500000],"
+ "PARAMETER[\"false_northing\",0],"
2022-12-14 18:02:19 +01:00
+ "UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]],"
2022-01-23 23:43:49 +01:00
+ "AXIS[\"Easting\",EAST],"
+ "AXIS[\"Northing\",NORTH],"
2024-09-11 23:55:47 +02:00
+ $"AUTHORITY[\"EPSG\",\"230{zone:00}\"]]";
2022-01-23 23:43:49 +01:00
}
}
}