Lets say I have a map in Mercator projection, and I know top and bottom latitudes:

topLatitude = 80; bottomLatitude = -55;

I also know width and height of a map:

width = 800; height = 500;

I want to rescale the map to Equirectangular projection, keeping the same width.

How can I calculate new height of a map?

  • 1
    Welcome! Please take a moment to take the tour here: gis.stackexchange.com/tour What software are you using? – MaryBeth Dec 18 '15 at 14:57
  • I am programming pure JavaScript thing, which one of the functions is to do such a scale. – zeroin Dec 18 '15 at 15:01
  • 1
    If you're trying to just apply a scale factor to the Y values, it won't work because the scale in Mercator differs as the latitude changes. If you are just trying to find the new height of map...Y range in EPSG:3857 is 22900577.2 while it's 15028131.3 in EPSG:32662 so around 328. – mkennedy Dec 18 '15 at 19:14

I came up with a solution.

This is formula to calculate x and y of Mercator projected map:

Here is function for y:

function degreesToRadians(degrees){
    return degrees / 180 * Math.PI;

function mercatorLatitudeToY(latitude){
    return Math.log(Math.tan(Math.PI / 4 + degreesToRadians(latitude) / 2));

When R=1 the result you get is radians. So I calculate y for top and bottom latitudes.

Next, I calculate the same radians if the projection is Equirectangular - I simply need to convert top and bottom latitude to radians. And last thing - I just need to find aspect ratio of differences:

var scale =  (mercatorLatitudeToY(topLatitude) - mercatorLatitudeToY(bottomLatitude))/ (degreesToRadians(topLatitude) - degreesToRadians(bottomLatitude));

For map without Antarctica, aspect ratio is ~1.5

  • The formulas are correct. However, applying them does not put the map into an Equirectangular projection: it merely distorts the Mercator projection. – whuber Dec 19 '15 at 16:08
  • Sure it doesn't. To change Mercator to Equirectangular you need to recalculate coordinates of each point of your shapes, but you need to know new dimensions of your map in order to plot them right. – zeroin Dec 19 '15 at 16:54

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.