mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2026-04-07 23:45:05 +00:00
Unified map projections
This commit is contained in:
parent
a4bd11e26d
commit
9fe7dccd68
21 changed files with 370 additions and 377 deletions
|
|
@ -1,4 +1,5 @@
|
|||
using System.Collections.Generic;
|
||||
using ProjNet.CoordinateSystems;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MapControl.Projections
|
||||
{
|
||||
|
|
@ -54,11 +55,175 @@ namespace MapControl.Projections
|
|||
var c when c is >= MapControl.Nad83UtmProjection.FirstZoneEpsgCode
|
||||
and <= MapControl.Nad83UtmProjection.LastZoneEpsgCode => new Nad83UtmProjection(c % 100),
|
||||
var c when c is >= MapControl.Wgs84UtmProjection.FirstZoneNorthEpsgCode
|
||||
and <= MapControl.Wgs84UtmProjection.LastZoneNorthEpsgCode => new Wgs84UtmProjection(c % 100, Hemisphere.North),
|
||||
and <= MapControl.Wgs84UtmProjection.LastZoneNorthEpsgCode => new Wgs84UtmProjection(c % 100, true),
|
||||
var c when c is >= MapControl.Wgs84UtmProjection.FirstZoneSouthEpsgCode
|
||||
and <= MapControl.Wgs84UtmProjection.LastZoneSouthEpsgCode => new Wgs84UtmProjection(c % 100, Hemisphere.South),
|
||||
and <= MapControl.Wgs84UtmProjection.LastZoneSouthEpsgCode => new Wgs84UtmProjection(c % 100, false),
|
||||
_ => base.CreateProjection(epsgCode)
|
||||
};
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Spherical Mercator Projection - EPSG:3857,
|
||||
/// implemented by setting the CoordinateSystem property of a ProjNetMapProjection.
|
||||
/// See "Map Projections - A Working Manual" (https://pubs.usgs.gov/pp/1395/report.pdf), p.41-44.
|
||||
/// </summary>
|
||||
public class WebMercatorProjection : ProjNetMapProjection
|
||||
{
|
||||
public WebMercatorProjection()
|
||||
: base(ProjectedCoordinateSystem.WebMercator)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elliptical Mercator Projection - EPSG:3395,
|
||||
/// implemented by setting the CoordinateSystemWkt property of a ProjNetMapProjection.
|
||||
/// See "Map Projections - A Working Manual" (https://pubs.usgs.gov/pp/1395/report.pdf), p.44-45.
|
||||
/// </summary>
|
||||
public class WorldMercatorProjection : ProjNetMapProjection
|
||||
{
|
||||
public WorldMercatorProjection() : base(
|
||||
"PROJCS[\"WGS 84 / World Mercator\"," +
|
||||
WktConstants.GeogCsWgs84 + "," +
|
||||
"PROJECTION[\"Mercator_1SP\"]," +
|
||||
"PARAMETER[\"latitude_of_origin\",0]," +
|
||||
"PARAMETER[\"central_meridian\",0]," +
|
||||
"PARAMETER[\"scale_factor\",1]," +
|
||||
"PARAMETER[\"false_easting\",0]," +
|
||||
"PARAMETER[\"false_northing\",0]," +
|
||||
"UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]]," +
|
||||
"AXIS[\"Easting\",EAST]," +
|
||||
"AXIS[\"Northing\",NORTH]," +
|
||||
"AUTHORITY[\"EPSG\",\"3395\"]]")
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// WGS84 Universal Transverse Mercator Projection -
|
||||
/// EPSG:32601 to EPSG:32660 and EPSG:32701 to EPSG:32760.
|
||||
/// </summary>
|
||||
public class Wgs84UtmProjection(int zone, bool north) : ProjNetMapProjection(
|
||||
ProjectedCoordinateSystem.WGS84_UTM(zone, north))
|
||||
{
|
||||
public int Zone => zone;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ETRS89 Universal Transverse Mercator Projection - EPSG:25828 to EPSG:25838.
|
||||
/// </summary>
|
||||
public class Etrs89UtmProjection(int zone) : ProjNetMapProjection(
|
||||
$"PROJCS[\"ETRS89 / UTM zone {zone}N\"," +
|
||||
WktConstants.GeogCsEtrs89 + "," +
|
||||
"PROJECTION[\"Transverse_Mercator\"]," +
|
||||
"PARAMETER[\"latitude_of_origin\",0]," +
|
||||
$"PARAMETER[\"central_meridian\",{6 * zone - 183}]," +
|
||||
"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\",\"258{zone:00}\"]]")
|
||||
{
|
||||
public int Zone => zone;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// NAD27 Universal Transverse Mercator Projection - EPSG:26701 to EPSG:26722.
|
||||
/// </summary>
|
||||
public class Nad27UtmProjection(int zone) : ProjNetMapProjection(
|
||||
$"PROJCS[\"NAD27 / UTM zone {zone}N\"," +
|
||||
WktConstants.GeogCsNad27 + "," +
|
||||
"PROJECTION[\"Transverse_Mercator\"]," +
|
||||
"PARAMETER[\"latitude_of_origin\",0]," +
|
||||
$"PARAMETER[\"central_meridian\",{6 * zone - 183}]," +
|
||||
"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\",\"267{zone:00}\"]]")
|
||||
{
|
||||
public int Zone => zone;
|
||||
}
|
||||
/// <summary>
|
||||
/// NAD83 Universal Transverse Mercator Projection - EPSG:26901 to EPSG:26923.
|
||||
/// </summary>
|
||||
public class Nad83UtmProjection(int zone) : ProjNetMapProjection(
|
||||
$"PROJCS[\"NAD83 / UTM zone {zone}N\"," +
|
||||
WktConstants.GeogCsNad83 + "," +
|
||||
"PROJECTION[\"Transverse_Mercator\"]," +
|
||||
"PARAMETER[\"latitude_of_origin\",0]," +
|
||||
$"PARAMETER[\"central_meridian\",{6 * zone - 183}]," +
|
||||
"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\",\"269{zone:00}\"]]")
|
||||
{
|
||||
public int Zone => zone;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ED50 Universal Transverse Mercator Projection.
|
||||
/// </summary>
|
||||
public class Ed50UtmProjection(int zone) : ProjNetMapProjection(
|
||||
$"PROJCS[\"ED50 / UTM zone {zone}N\"," +
|
||||
WktConstants.GeogCsEd50 + "," +
|
||||
"PROJECTION[\"Transverse_Mercator\"]," +
|
||||
"PARAMETER[\"latitude_of_origin\",0]," +
|
||||
$"PARAMETER[\"central_meridian\",{6 * zone - 183}]," +
|
||||
"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{zone: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; } = zone;
|
||||
}
|
||||
|
||||
public class Wgs84UpsNorthProjection : ProjNetMapProjection
|
||||
{
|
||||
public Wgs84UpsNorthProjection() : base(
|
||||
"PROJCS[\"WGS 84 / UPS North (N,E)\"," +
|
||||
WktConstants.GeogCsWgs84 + "," +
|
||||
"PROJECTION[\"Polar_Stereographic\"]," +
|
||||
"PARAMETER[\"latitude_of_origin\",90]," +
|
||||
"PARAMETER[\"central_meridian\",0]," +
|
||||
"PARAMETER[\"scale_factor\",0.994]," +
|
||||
"PARAMETER[\"false_easting\",2000000]," +
|
||||
"PARAMETER[\"false_northing\",2000000]," +
|
||||
"UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]]," +
|
||||
"AUTHORITY[\"EPSG\",\"32661\"]]")
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public class Wgs84UpsSouthProjection : ProjNetMapProjection
|
||||
{
|
||||
public Wgs84UpsSouthProjection() : base(
|
||||
"PROJCS[\"WGS 84 / UPS South (N,E)\"," +
|
||||
WktConstants.GeogCsWgs84 + "," +
|
||||
"PROJECTION[\"Polar_Stereographic\"]," +
|
||||
"PARAMETER[\"latitude_of_origin\",-90]," +
|
||||
"PARAMETER[\"central_meridian\",0]," +
|
||||
"PARAMETER[\"scale_factor\",0.994]," +
|
||||
"PARAMETER[\"false_easting\",2000000]," +
|
||||
"PARAMETER[\"false_northing\",2000000]," +
|
||||
"UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]]," +
|
||||
"AUTHORITY[\"EPSG\",\"32761\"]]")
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue