diff --git a/MapProjections/Shared/GeoApiProjection.cs b/MapProjections/Shared/GeoApiProjection.cs index acf4a42c..1baf2ee2 100644 --- a/MapProjections/Shared/GeoApiProjection.cs +++ b/MapProjections/Shared/GeoApiProjection.cs @@ -96,21 +96,21 @@ namespace MapControl.Projections public IMathTransform MapToLocationTransform { get; private set; } - public override Point GetRelativeScale(Location location) + public override Point GetRelativeScale(double latitude, double longitude) { var k = coordinateSystem?.Projection?.GetParameter("scale_factor")?.Value ?? 1d; return new Point(k, k); } - public override Point? LocationToMap(Location location) + public override Point? LocationToMap(double latitude, double longitude) { if (LocationToMapTransform == null) { throw new InvalidOperationException("The CoordinateSystem property is not set."); } - var coordinate = LocationToMapTransform.Transform(new Coordinate(location.Longitude, location.Latitude)); + var coordinate = LocationToMapTransform.Transform(new Coordinate(longitude, latitude)); if (coordinate == null) { @@ -120,14 +120,14 @@ namespace MapControl.Projections return new Point(coordinate.X, coordinate.Y); } - public override Location MapToLocation(Point point) + public override Location MapToLocation(double x, double y) { if (MapToLocationTransform == null) { throw new InvalidOperationException("The CoordinateSystem property is not set."); } - var coordinate = MapToLocationTransform.Transform(new Coordinate(point.X, point.Y)); + var coordinate = MapToLocationTransform.Transform(new Coordinate(x, y)); return new Location(coordinate.Y, coordinate.X); } diff --git a/MapProjections/Shared/WebMercatorProjection.cs b/MapProjections/Shared/WebMercatorProjection.cs index 27b15d25..c8cbb219 100644 --- a/MapProjections/Shared/WebMercatorProjection.cs +++ b/MapProjections/Shared/WebMercatorProjection.cs @@ -19,9 +19,9 @@ namespace MapControl.Projections CoordinateSystem = ProjectedCoordinateSystem.WebMercator; } - public override Point GetRelativeScale(Location location) + public override Point GetRelativeScale(double latitude, double longitude) { - var k = 1d / Math.Cos(location.Latitude * Math.PI / 180d); // p.44 (7-3) + var k = 1d / Math.Cos(latitude * Math.PI / 180d); // p.44 (7-3) return new Point(k, k); } diff --git a/MapProjections/Shared/WorldMercatorProjection.cs b/MapProjections/Shared/WorldMercatorProjection.cs index 56853147..8dc5b74f 100644 --- a/MapProjections/Shared/WorldMercatorProjection.cs +++ b/MapProjections/Shared/WorldMercatorProjection.cs @@ -40,9 +40,9 @@ namespace MapControl.Projections + "AUTHORITY[\"EPSG\",\"3395\"]]"; } - public override Point GetRelativeScale(Location location) + public override Point GetRelativeScale(double latitude, double longitude) { - var lat = location.Latitude * Math.PI / 180d; + var lat = latitude * Math.PI / 180d; var eSinLat = Wgs84Eccentricity * Math.Sin(lat); var k = Math.Sqrt(1d - eSinLat * eSinLat) / Math.Cos(lat); // p.44 (7-8)