Mercator Map: pinpoint a coordinate
Hey, I'm creating a game where I need an accurate world map with real world cities at the correct places. For this, I'm reading a file with all the cities and their locations. Now my question is how do I convert the coordinates to the correct x,y position on the map?
I found this wiki page eplaining some formulas. I assume I just need this bit:
X = R longitude Y = R ln[ tan( pi/4 + latitude/2) ]
I got my map using SASplanet, which tells me the R = 6378137.
I positioned my map so 0°N 0°E = 0,0 (x,y)
what would be the next step?
I ran some test coordinates through this calculator. But it gives different results than my manual calculation??
If I divide the longitude by roughly 366 800, I get somewhat accurate positions on my map for Brussels, London, New York and Miami. But if I try San Francisco it is significantly off. If I readjust, the others are off. Strange, I thought a Mercator projection didn't change longitude?
So, any idea on how to pinpoint a coordinate on a map in Unity? Or is there a tutorial somewhere? (I couldn't find one)
edit: I changed to a Equirectangular projected map, which is easier to work with.