Search code examples
google-mapslatitude-longitudegeography

How to convert latitude and longitude to world coordinates à la Google Maps


I am designing an application in C++ to view and edit a map of a fictional planet. How it works will be similar to Google Maps. I would like the user to be able to see their current position in latitude/longitude and world coordinates on the GUI.

How can I convert a latitude and longitude values to "world coordinates" and back, as in Google Maps? or to "pixel coordinates" and back?


Solution

  • I found the answer to my question. The formulas for converting between the different coordinate systems can be found in the source code of this example on the Google Maps API website: http://code.google.com/apis/maps/documentation/javascript/examples/map-coordinates.html