Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 374
Jake Petroules Avatar asked Jun 22 '10 07:06

Jake Petroules


People also ask

How do I format coordinates in Google Maps?

To format your coordinates so they work in Google Maps, use decimal degrees in the following format: Correct: 41.40338, 2.17403. Incorrect: 41,40338, 2,17403.


1 Answers

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

like image 135
Jake Petroules Avatar answered Oct 27 '22 11:10

Jake Petroules