1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-27 21:24:47 +01:00

Properly name the web mercator projection

This commit is contained in:
Martin Tůma 2018-05-12 22:38:42 +02:00
parent 80f13d7057
commit 2b421f3b63
5 changed files with 22 additions and 22 deletions

View File

@ -69,7 +69,7 @@ HEADERS += src/config.h \
src/map/projection.h \
src/map/ellipsoid.h \
src/map/datum.h \
src/map/mercator.h \
src/map/webmercator.h \
src/map/transversemercator.h \
src/map/latlon.h \
src/map/utm.h \
@ -185,7 +185,7 @@ SOURCES += src/main.cpp \
src/map/matrix.cpp \
src/map/ellipsoid.cpp \
src/map/datum.cpp \
src/map/mercator.cpp \
src/map/webmercator.cpp \
src/map/transversemercator.cpp \
src/map/utm.cpp \
src/map/lambertconic.cpp \

View File

@ -1,15 +0,0 @@
#ifndef MERCATOR_H
#define MERCATOR_H
#include "ct.h"
class Mercator : public CT
{
public:
virtual CT *clone() const {return new Mercator(*this);}
virtual PointD ll2xy(const Coordinates &c) const;
virtual Coordinates xy2ll(const PointD &p) const;
};
#endif // MERCATOR_H

View File

@ -1,5 +1,5 @@
#include "datum.h"
#include "mercator.h"
#include "webmercator.h"
#include "transversemercator.h"
#include "lambertconic.h"
#include "albersequal.h"
@ -37,7 +37,7 @@ Projection::Projection(const PCS *pcs) : _gcs(pcs->gcs()), _units(pcs->units()),
switch (pcs->method().id()) {
case 1024:
case 9841:
_ct = new Mercator();
_ct = new WebMercator();
break;
case 9801:
case 9815: // Oblique mercator aproximation using LCC1

View File

@ -1,15 +1,15 @@
#include <cmath>
#include "common/coordinates.h"
#include "common/wgs84.h"
#include "mercator.h"
#include "webmercator.h"
PointD Mercator::ll2xy(const Coordinates &c) const
PointD WebMercator::ll2xy(const Coordinates &c) const
{
return PointD(deg2rad(c.lon()) * WGS84_RADIUS,
log(tan(M_PI/4.0 + deg2rad(c.lat())/2.0)) * WGS84_RADIUS);
}
Coordinates Mercator::xy2ll(const PointD &p) const
Coordinates WebMercator::xy2ll(const PointD &p) const
{
return Coordinates(rad2deg(p.x() / WGS84_RADIUS),
rad2deg(2 * atan(exp(p.y() / WGS84_RADIUS)) - M_PI/2));

15
src/map/webmercator.h Normal file
View File

@ -0,0 +1,15 @@
#ifndef WEBMERCATOR_H
#define WEBMERCATOR_H
#include "ct.h"
class WebMercator : public CT
{
public:
virtual CT *clone() const {return new WebMercator(*this);}
virtual PointD ll2xy(const Coordinates &c) const;
virtual Coordinates xy2ll(const PointD &p) const;
};
#endif // WEBMERCATOR_H