Talk:Geographic coordinate conversion

From Wikipedia, the free encyclopedia
Jump to: navigation, search
WikiProject Maps (Rated C-class, High-importance)
WikiProject icon This article is within the scope of WikiProject Maps, a collaborative effort to improve the coverage of Maps and Cartography on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.
C-Class article C  This article has been rated as C-Class on the project's quality scale.
Checklist icon
 High  This article has been rated as High-importance on the project's importance scale.
This article had an importance automatically assigned to it. Once it has been checked by a human, please remove |autoi=yes.
WikiProject Geographical coordinates
WikiProject icon Geographic coordinate conversion is of interest to WikiProject Geographical coordinates, which encourages the use of geographical coordinates in Wikipedia. If you would like to participate, please visit the project page, where you can join the project and see a list of open tasks.

Conversion code[edit]

The PHP code is too simple. For instance, given the input value "12.999992", the output is "12° 60.000". This is a classical rounding problem. Here are two Perl subroutines which get it right. The second uses Perl's automatic conversion between numbers and strings, a feature not available in all languages. I don't know PHP well enough to write it, but the Perl code below should be understandable by most programmers. –Peter J. Acklam 10:24, 22 Apr 2005 (UTC)

 sub pretty_coord {
     my $coord = abs shift;            # decimal degrees
     my $deg = int $coord;             # compute degrees
     my $min = 60 * ($coord - $deg);   # compute minutes
     if ($min >= 59.9995) {            # if value will be rounded to 60.000
         $min = 0;                     #   set it to zero
         $deg ++;                      #   and increment degrees
     return sprintf("%0.0f° %06.3f", $deg, $min);

 sub pretty_coord {
     my $coord = abs shift;            # decimal degrees
     my $deg = int $coord;             # compute degrees
     my $min = 60 * ($coord - $deg);   # compute minutes
     $min = sprintf '%.3f', $min;      # round to three digits
     if ($min == 60) {                 # if result is 60
         $min = 0;                     #   set it to zero
         $deg ++;                      #   and increment degrees
     return sprintf("%0.0f° %06.3f", $deg, $min);
I've added a new PHP function which I use as part of my website engine. Works well and is more robust & easier to follow than the original "pretty_coord()" example –Andrew N. Thu, 10 Aug 2006 05:04:42 +1000 (UTC)
Is it more robust? It converts "12.5832" into "12:34:60", which should have been "12:35:00". It seems that your code is suffering from the exact same problem as the other code examples. –Peter J. Acklam 11:25, 8 May 2007 (UTC)

Legal ranges[edit]

What are the ranges of degrees, minutes and seconds that are allowed to use? And also what are the allowed number systems for the numbers? What do you think about these values:
23° -45' 22.1"
-23° -45' -22.1"
-(23° 45' 22.1")
23° 61' 61"
23° 45.7' 22.1"

-- 05:28, 20 July 2006 (UTC)


This article pretends, that the world has only WGS84-coordinates. That's not true, there are others like Gauss-Krüger coordinate system, so the name of the article or the article should be changed. -- (talk) 09:22, 8 October 2008 (UTC)

Complete rewrite[edit]

With this article slated for deletion and all the good howto information exported to Wikiversity, I decided to completely rewrite the article. The conversion between degrees-minutes-seconds and decimal degrees has been condensed into a short section, while all the other types of conversions of geographic coordinates, such as conversions among datums, has been added. It is still incomplete in many places (e.g., the datum conversion methods could be filled out with more formulas and application examples), but is hopefully a good start on this notable subject based on reliable sources. --Mark viking (talk) 22:16, 5 March 2014 (UTC)


Someone added a tag proposing a merge with Geographic coordinate system. I merged material on overlapping topics, but decided most of what's here is technical and probably uninteresting to readers of the other article. Also, much of what's here applies to geographic datum and I think merging all three articles would probably make the result too long. So, I'm leaving this article as a standalone, and noting in the intro that readers are expected to be familiar with the content of the other two articles (since I removed the context from this article for the sake of not repeating ourselves). -- Beland (talk) 09:42, 29 July 2015 (UTC)

Your approach makes good sense to me. There is a lot of detail here that would not be interesting to someone just wanting to learn a little more about geographic coordinates and how to read maps. Thanks, --Mark viking (talk) 17:46, 29 July 2015 (UTC)

External links modified[edit]

Hello fellow Wikipedians,

I have just modified 2 external links on Geographic coordinate conversion. Please take a moment to review my edit. If you have any questions, or need the bot to ignore the links, or the page altogether, please visit this simple FaQ for additional information. I made the following changes:

When you have finished reviewing my changes, you may follow the instructions on the template below to fix any issues with the URLs.

You may set the |checked=, on this template, to true or failed to let other editors know you reviewed the change. If you find any errors, please use the tools below to fix them or call an editor by setting |needhelp= to your help request.

  • If you have discovered URLs which were erroneously considered dead by the bot, you can report them with this tool.
  • If you found an error with any archives or the URLs themselves, you can fix them with this tool.

If you are unable to use these tools, you may set |needhelp=<your help request> on this template to request help from an experienced user. Please include details about your problem, to help other editors.

Cheers.—InternetArchiveBot (Report bug) 12:38, 9 January 2017 (UTC)