Version 4.12. Revised projections

This commit is contained in:
ClemensF 2018-12-20 21:55:12 +01:00
parent 8cafe207cb
commit 90aa92def0
25 changed files with 390 additions and 167 deletions

View file

@ -3,21 +3,12 @@
// Licensed under the Microsoft Public License (Ms-PL)
using System;
#if !WINDOWS_UWP
using System.Windows;
#endif
using ProjNet.CoordinateSystems;
namespace MapControl.Projections
{
public class UtmProjection : GeoApiProjection
{
private const string wktFormat = "PROJCS[\"WGS 84 / UTM zone {0}\", GEOGCS[\"WGS 84\", DATUM[\"WGS_1984\", SPHEROID[\"WGS 84\", 6378137, 298.257223563, AUTHORITY[\"EPSG\", \"7030\"]], AUTHORITY[\"EPSG\", \"6326\"]], PRIMEM[\"Greenwich\", 0, AUTHORITY[\"EPSG\", \"8901\"]], UNIT[\"degree\", 0.01745329251994328, AUTHORITY[\"EPSG\", \"9122\"]], AUTHORITY[\"EPSG\", \"4326\"]], UNIT[\"metre\", 1, AUTHORITY[\"EPSG\", \"9001\"]], PROJECTION[\"Transverse_Mercator\"], PARAMETER[\"latitude_of_origin\", 0], PARAMETER[\"central_meridian\", {1}], PARAMETER[\"scale_factor\", 0.9996], PARAMETER[\"false_easting\", 500000], PARAMETER[\"false_northing\", {2}], AUTHORITY[\"EPSG\", \"{3}\"], AXIS[\"Easting\", EAST], AXIS[\"Northing\", NORTH]]";
public UtmProjection()
{
TrueScale = 0.9996 * MetersPerDegree;
}
private string zone;
public string Zone
@ -48,7 +39,7 @@ namespace MapControl.Projections
public void SetZone(int zoneNumber, bool north)
{
if (zoneNumber < 1 || zoneNumber > 60)
if (zoneNumber < 1 || zoneNumber > 61)
{
throw new ArgumentException("Invalid UTM zone number.");
}
@ -57,12 +48,8 @@ namespace MapControl.Projections
if (zone != zoneName)
{
var centralMeridian = zoneNumber * 6 - 183;
var falseNorthing = north ? 0 : 10000000;
var authorityCode = (north ? 32600 : 32700) + zoneNumber;
zone = zoneName;
WKT = string.Format(wktFormat, zone, centralMeridian, falseNorthing, authorityCode);
CoordinateSystem = ProjectedCoordinateSystem.WGS84_UTM(zoneNumber, north);
}
}