Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes for webmerc projection (fixes #1078) #1095

Merged
merged 1 commit into from Aug 21, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 8 additions & 4 deletions docs/source/operations/projections/webmerc.rst
Expand Up @@ -24,9 +24,9 @@ From `Wikipedia <https://en.wikipedia.org/wiki/Web_Mercator>`_:
+---------------------+----------------------------------------------------------+
| **Classification** | Cylindrical (non conformant if used with ellipsoid) |
+---------------------+----------------------------------------------------------+
| **Available forms** | Forward and inverse, spherical projection |
| **Available forms** | Forward and inverse |
+---------------------+----------------------------------------------------------+
| **Defined area** | Global, but best used near the equator |
| **Defined area** | Global |
+---------------------+----------------------------------------------------------+
| **Alias** | webmerc |
+---------------------+----------------------------------------------------------+
Expand All @@ -49,9 +49,13 @@ Example::
Parameters
################################################################################

.. note:: All parameters for the projection are optional.
.. note:: All parameters for the projection are optional, except the ellipsoid
definition, which is WGS84 for the typical use case of EPSG:3857.
In which case, the other parameters are set to their default 0 value.

.. include:: ../options/R.rst
.. include:: ../options/ellps.rst

.. include:: ../options/lon_0.rst

.. include:: ../options/x_0.rst

Expand Down
10 changes: 2 additions & 8 deletions src/PJ_merc.c
Expand Up @@ -9,7 +9,7 @@
#include "projects.h"

PROJ_HEAD(merc, "Mercator") "\n\tCyl, Sph&Ell\n\tlat_ts=";
PROJ_HEAD(webmerc, "Web Mercator / Pseudo Mercator") "\n\tCyl, Sph\n\t";
PROJ_HEAD(webmerc, "Web Mercator / Pseudo Mercator") "\n\tCyl, Ell\n\t";

#define EPS10 1.e-10
static double logtanpfpim1(double x) { /* log(tan(x/2 + M_FORTPI)) */
Expand Down Expand Up @@ -92,15 +92,9 @@ PJ *PROJECTION(merc) {

PJ *PROJECTION(webmerc) {

/* Overriding k_0, lat_0 and lon_0 with fixed parameters */
/* Overriding k_0 with fixed parameter */
P->k0 = 1.0;
P->phi0 = 0.0;
P->lam0 = 0.0;

P->b = P->a;
/* Clean up the ellipsoidal parameters to reflect the sphere */
P->es = P->e = P->f = 0;
pj_calc_ellipsoid_params (P, P->a, 0);
P->inv = s_inverse;
P->fwd = s_forward;
return P;
Expand Down