Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I was inspired by this wikipedia image from the mercator projections page to hack around with leaflet. The idea was to interactively have your cursor move a continent and that it would be corrected for the projection.

See the following JSFiddle for the status sofar;

I am a bit new in the projections world and although the demo works well enough for the latitude. When I compare the equirectangular and the mercator projection on wikipedia I get the impression that the projection's bias is only on the 'y-axis' when you compare these two projections.

I get the impression that I am not correcting for the longitude due to the first wikipedia picture. I would like to support this but I don't know what the best way to do this is.

Currently the way I am able to show the bias of the mercator projection is by shifting the coordinates to the mousecursor everytime the mouse moves;

map.on("mousemove", function(d){ 
    Object.keys(myLayer._layers).map(function(d){ myLayer.removeLayer( myLayer._layers[d] ) })

    var plotCoords = [];

    // green is the coordinate array for the landmass 
    var green = [ [-46.76373672, 82.62796021],... ]

    for ( i in green ) {
       // shift the landmass to where the cursor is
       var x = d.latlng.lng + green[i][0] + 40
       var y = + green[i][1] - 80
       circleCoords.push( [ x,y ] );

    window.coords = plotCoords

    window.geojsonFeature = {
      "type": "Feature",
      "properties": {},
      "geometry": {
          "type": "Polygon",
          "coordinates": [coords]



What would be the best way to have this interactive leaflet plot also show the effect as shown on wikipedia.

-- Edit!

For more examples see my blog;

share|improve this question
Nice idea ! It seems to be correct. With Mercator, the spacing between meridian is preserved wherever you are, so your relative longitudinal extent should not change when you move your polygon. – radouxju Jan 24 '14 at 13:44
DRTL. Frank's bro? – Willy Apr 13 '14 at 14:00
awesome, I may use this in class. – If you do not know- just GIS May 22 '14 at 0:52 has the newest blog post now. glad to hear people like it. – Vincent Warmerdam May 22 '14 at 6:11
What exactly do you mean by “corrected for the projection”? Also, what is the purpose of the code? It doesn't seem to add anything to the question. – Martin F Jun 7 '14 at 23:51

I think you wish to change both the relative latitude and relative longitude of the moveable region such that each relative coordinate now appears to be only distorted as much as is the case for other regions that are at the same new latitude? If so, then @radouxju is incorrect and you’re currently only half way there. One defining characteristic of conformal projections, such as Mercator, is that at any point on the globe/map the linear scale factor is constant in all directions. Thus whatever changes you make to the Y-scale as you move should also be made to the X-scale.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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