Where did these variables come from
These variables are selected so that they correspond to the calculated coordinates of the background image of the map. If the map projection parameters were known, they could be calculated. But I believe that it is much more likely that they were obtained through trial and error.
How to calculate the Mercator projection
If you want a more general method to describe the world section of a given (non-transverse) Mercator map , you can use this code:
A demo version of this code is available at http://ideone.com/05OhG6 .
Regarding aspect ratio
Customizing with $xFactor != $yFactor creates a kind of stretched Mercator projection. This is no longer conformal (angular conservation). If you need a true Mercator projection, you can omit any of the first six variable assignments, i.e. those that define the bounding box or those that describe the size of the resulting map, and then use some calculations, also select it, satisfying $xFactor == $yFactor . But since the choice to be omitted is arbitrary, I believe that the above code is the most symmetrical way of describing things.
source share