"In Mercator projection the scale factor is changed along the meridians as a function of latitude"

How to calculate the Mercator scale factor as a function of the latitude in decimal degrees ?

I map any country of the world using it's bounding boxe's values.

1. In Equirectangular: The image width is linearly proportionate to the substraction of longitude values. The image height is linearly proportionate to the substraction of latitude values. enter image description here

2. Moving to Mercator: The image width is linearly proportionate to the substraction of longitude values. The image height is linearly proportionate to the substraction of latitude values mutiplied by the scale factor at this average latitude. enter image description here



By definition, the scale is the amount by which (infinitesimal) distances are multiplied by the projection. Whenever a tiny displacement of d meters on the earth is associated with a displacement of d/s meters on the map, the scale is written as 1:s. It may depend on the direction of the displacement.

The scale factor compares the scale at points on the map to the map's nominal scale. For instance, if the nominal scale is 1:25000 but the scale at a point (in a particular direction) actually is 1:50000, then the scale factor at that point is (1/50000) divided by (1/25000), equal to 1/2.

Special Characteristics of the Mercator Projection

For many projections, scale depends on location and bearing. For conformal projections like the Mercator, though, scale is constant at all bearings (at any given location) and depends only on position. (This is the defining characteristic of a conformal projection.) Moreover, with cylindrical projections of surfaces of revolution (and the Mercator is one of them, too), scale does not depend on longitude. Therefore, the Mercator scale depends only on the latitude.

Answers for Spherical and Ellipsoidal Models

For precise work, the scale and scale factors depend a little bit on the model of the earth's surface.

  • For a spherical model, the scale factor of the Mercator projection is proportional to the secant of the latitude (Snyder, equation 7-3).

    (This is intuitively obvious because any cylindrical projection, with its vertical meridian lines, allows for no horizontal adjustment in distances on the map. Therefore the horizontal scale at any latitude must be inversely proportional to lengths on the earth's surface in east-west directions. These will shrink in proportion to the circumferences of the circles of latitude. Equivalently, they are proportional to the radii of those circles, which--by definition of the cosine--vary with the cosine of the latitude. The secant merely is the reciprocal of the cosine.)

    For example, at a latitude of 60 degrees the secant equals 2 whereas at the Equator (0 degrees) the secant equals 1. Therefore sizes of features are magnified by 2/1 at 60 degrees latitude compared to at the Equator.

    Figure 1: Mercator scale factor, spherical model, plotted for 0 to 90 degrees latitude

    The graph of the secant function rises infinitely high as the latitude approaches 90 degrees.

  • For an ellipsoidal model with eccentricity e, the scale factor is sqrt(1 - e^2 sin^2(f)) * sec(f) at latitude f (Snyder, equation 7-8). The function sqrt(1 - e^2 sin^2(f)) multiplies the secant of f to correct for the eccentricity. For the (common) WGS 84 model, for instance, e is approximately 0.006694379990141317. This multiplier therefore ranges from 1 at the Equator down to sqrt(1 - e^2) at the poles, amounting to a shrinkage of 22.41 parts per million compared to the secant formula.

    Figure 2: Plot of scale factor correction, WGS model

    This plot shows the multiplicative correction to the simple secant formula that should be applied for the WGS 84 ellipsoid. The correction is practically indistinguishable from this for any ellipsoid in standard use.

    An algebraically equivalent expression for the scale factor is Sqrt(((Sec(f))^2*(1-e^2) + e^2); this requires only one trigonometric calculation rather than two. The values 1-e^2 and e^2 are constants that can be precomputed. An excellent approximation (accurate to 5E-11 everywhere) which avoids the square root is (1 + c2*(cos(2*f) - 1)) / cos(f) where c2 = 0.00001120378. (It is based on the first two terms of the Fourier series for the correction factor.)

In either case the scale factor for the Mercator projection ranges from a low of 1 at the Equator up to arbitrarily large values near the poles.


John P. Snyder, Map Projections--A Working Manual. USGS Professional Paper 1395, 1987. Available on the Web at http://pubs.er.usgs.gov/publication/pp1395.

| improve this answer | |
  • Thanks for this details who shade further light on this question :) – Hugolpz Aug 18 '14 at 16:51
  • how to read e^2 sin^2(f) or could you write the JS of it ? If I get JS math well, it's power(e, 2)*power(sin(lat),2). e: eccentricity in <unit>, lat: latitude in <unit>. – Hugolpz Aug 18 '14 at 16:55
  • See the heading to the vertical axis in the second figure. – whuber Aug 18 '14 at 16:57
  • Oh, thanks, it helps. I'am confuse with the sin²(angle), which doesn't make sense as far as I remember my highschool algebra. Is it rather ( sin(angle) )² ? – Hugolpz Aug 18 '14 at 17:02
  • You're right--but this is standard mathematical notation. It is intended to distinguish (sin(f))^2 clearly from sin(f^2). How you convert mathematics into a program depends on the application language. – whuber Aug 18 '14 at 17:21

1. Degrees to Radians: convert decimal degrees to radians, in JS:

// Converts from degrees to radians.
Math.radians = function (degrees) {
    return degrees * Math.PI / 180;
console.log(Math.radians(45) * 4); // correctly = PI

2. Calcul of scale factor k: Then, mathematicians, who generally talk in Radians, expose :

"In Mercator projection the scale factor is changed along the meridians as a function of latitude to keep the scale factor equal in all direction: k=sec(latitude)"

Wikipedia and others tell us that sec(α) = 1 / cos(α).

The scale factor k is :

var scale_factor = function (degrees) {
    return 1 / Math.cos(Math.radians(degrees))

3. Corrective WGS84 factor: We can alsi adjust to WGS 84 models. Given e:excentricity ~ 0.006694379990141317, we calculate the corrective factor :

c = sqrt(1 - power(e, 2)*power(sin(radians),2) )

updated scale factor is k' = k*c.

Implementation on this fiddle.

As I have the bounding box bb of my area to map, I calculate the median latitude m = (bb.North + bb.South) /2, my k = scale_factor(m) as a nice average !

Edit: Interestingly, this appears to be of little (=NO) use for automation applied to large frame. Indeed, since the relation include logarithmic cos or 1/cos, the transformation is non linear, so combining true Mercator data with a frame where height = Equirect's height * scale_factor(central_latitude) is just incorrect, especially for very tall areas. Below is my end output for India, mixing Mercator data and pseudo-Mercator frame obtains via h'=h*k, with k= sec(α):

enter image description here

Please note the left and right margin.

Also, I migrated back to an Equirectangualar data and an easy to get Equirectangular frame, both strectch vertically by k (D3js: How to stretch object vertically?), thus giving a duo of pseudo-Mercator dataviz & frame.

| improve this answer | |

This script converts lat/lon coordinates to mercator coordinates using mercator scale

r = 6378137;
scale = cos(lat * pi / 180.0);
x = scale * lon * pi * r / 180;
y = scale * r * log( tan((90+lat) * pi / 360) );

| improve this answer | |
  • Note that this makes assumptions about the kind of mercator projection (basically that the earth is a sphere) which is not always valid. – BradHards Jun 17 '16 at 11:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.