mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2026-04-06 06:55:04 +00:00
Version 4.12. Revised projections
This commit is contained in:
parent
8cafe207cb
commit
90aa92def0
25 changed files with 390 additions and 167 deletions
33
MapProjections/Shared/WebMercatorProjection.cs
Normal file
33
MapProjections/Shared/WebMercatorProjection.cs
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
// XAML Map Control - https://github.com/ClemensFischer/XAML-Map-Control
|
||||
// © 2018 Clemens Fischer
|
||||
// Licensed under the Microsoft Public License (Ms-PL)
|
||||
|
||||
using System;
|
||||
#if !WINDOWS_UWP
|
||||
using System.Windows;
|
||||
#endif
|
||||
using ProjNet.CoordinateSystems;
|
||||
|
||||
namespace MapControl.Projections
|
||||
{
|
||||
/// <summary>
|
||||
/// Spherical Mercator Projection implemented by setting the CoordinateSystem property of a GeoApiProjection.
|
||||
/// See "Map Projections - A Working Manual" (https://pubs.usgs.gov/pp/1395/report.pdf), p.41-44.
|
||||
/// </summary>
|
||||
public class WebMercatorProjection : GeoApiProjection
|
||||
{
|
||||
public WebMercatorProjection()
|
||||
{
|
||||
IsWebMercator = true;
|
||||
IsNormalCylindrical = true;
|
||||
CoordinateSystem = ProjectedCoordinateSystem.WebMercator;
|
||||
}
|
||||
|
||||
public override Vector GetMapScale(Location location)
|
||||
{
|
||||
var k = 1d / Math.Cos(location.Latitude * Math.PI / 180d); // p.44 (7-3)
|
||||
|
||||
return new Vector(ViewportScale * k, ViewportScale * k);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue