Added Ed50UtmProjection

This commit is contained in:
Clemens 2022-01-23 23:43:49 +01:00
parent 0896209e22
commit a0ee9ebbd1
2 changed files with 57 additions and 0 deletions

View file

@ -0,0 +1,51 @@
// XAML Map Control - https://github.com/ClemensFischer/XAML-Map-Control
// © 2022 Clemens Fischer
// Licensed under the Microsoft Public License (Ms-PL)
using System;
namespace MapControl.Projections
{
public class Ed50UtmProjection : GeoApiProjection
{
public Ed50UtmProjection(int zone)
{
SetZone(zone);
}
protected void SetZone(int zone)
{
if (zone < 28 || zone > 38)
{
throw new ArgumentException($"Invalid UTM zone {zone}.", nameof(zone));
}
const string wktFormat
= "PROJCS[\"ED50 / UTM zone {0}N\","
+ "GEOGCS[\"ED50\","
+ "DATUM[\"European_Datum_1950\","
+ "SPHEROID[\"International 1924\",6378388,297,"
+ "AUTHORITY[\"EPSG\",\"7022\"]],"
+ "TOWGS84[-87,-98,-121,0,0,0,0],"
+ "AUTHORITY[\"EPSG\",\"6230\"]],"
+ "PRIMEM[\"Greenwich\",0,"
+ "AUTHORITY[\"EPSG\",\"8901\"]],"
+ "UNIT[\"degree\",0.0174532925199433,"
+ "AUTHORITY[\"EPSG\",\"9122\"]],"
+ "AUTHORITY[\"EPSG\",\"4230\"]],"
+ "PROJECTION[\"Transverse_Mercator\"],"
+ "PARAMETER[\"latitude_of_origin\",0],"
+ "PARAMETER[\"central_meridian\",{1}],"
+ "PARAMETER[\"scale_factor\",0.9996],"
+ "PARAMETER[\"false_easting\",500000],"
+ "PARAMETER[\"false_northing\",0],"
+ "UNIT[\"metre\",1,"
+ "AUTHORITY[\"EPSG\",\"9001\"]],"
+ "AXIS[\"Easting\",EAST],"
+ "AXIS[\"Northing\",NORTH],"
+ "AUTHORITY[\"EPSG\",\"230{0}\"]]";
WKT = string.Format(wktFormat, zone, 6 * zone - 183);
}
}
}

View file

@ -8,6 +8,8 @@ namespace MapControl.Projections
{ {
public const int WorldMercator = 3395; public const int WorldMercator = 3395;
public const int WebMercator = 3857; public const int WebMercator = 3857;
public const int Ed50UtmFirst = 23028;
public const int Ed50UtmLast = 23038;
public const int Etrs89UtmFirst = 25828; public const int Etrs89UtmFirst = 25828;
public const int Etrs89UtmLast = 25838; public const int Etrs89UtmLast = 25838;
public const int Wgs84UtmNorthFirst = 32601; public const int Wgs84UtmNorthFirst = 32601;
@ -33,6 +35,10 @@ namespace MapControl.Projections
projection = new WebMercatorProjection(); projection = new WebMercatorProjection();
break; break;
case int c when c >= Ed50UtmFirst && c <= Ed50UtmLast:
projection = new Ed50UtmProjection(epsgCode % 100);
break;
case int c when c >= Etrs89UtmFirst && c <= Etrs89UtmLast: case int c when c >= Etrs89UtmFirst && c <= Etrs89UtmLast:
projection = new Etrs89UtmProjection(epsgCode % 100); projection = new Etrs89UtmProjection(epsgCode % 100);
break; break;