I've been trying to plot a set of lat and long coordinates to a Mercator map using the following set of equations:
x = long - long0 y = ln(tan(pi/4 + lat/2))
These equations are from a page on Wolfram.
I'm using a Mercator map from Wikipedia, it's from 82 N to 82 S. Based on this I've got the current set of equations to fully map the lat/long to the image:
height = image height in pixels width = image width in pixels x = long * PI/180 x = x * width/(2 * PI) + width/2 latRange = 2 * 82 * PI/180 y = ln(tan(PI/4 + lat/2)) y = -(y*height/latRange - height/2)
However when I make the image I get points on my map that are higher than expected (I try to plot the tropic of cancer and I hit the north coast of Algeria).
So, can someone please tell me where I'm going wrong?