Convert Latitude Longitude to Degree Minutes Seconds for Maps

Hello World!

If you have ever done mapping applications, you may have encountered needing to do this.  It takes a lot of looking around the internet to finally find the right equation etc.  For our application, we need to do this for google maps, as it does not take a latitude/longitude combination like bing maps.  If you choose to support ONLY bing maps, your job is easy, as here is the format: http://www.bing.com/maps/default.aspx?q=LATITUDE%2c+LONGITUDE (include negative signs if necessary).  However Google maps requires more work (UGH!) https://www.google.com/maps/place/LATITUDE <directional> LONGITUDE <directional>, ZOOM (with various encoded separators).

This article goes through the code that converts latitude longitude like you will pull from a phone’s gps into the DMS format needed by google maps.  Again, you don’t even need to bother with this conversion if you choose to use bing maps, it is simply as stated above.

Continue reading