Thanks for your help on writing geographic coordinates in $YOUR language

A few days ago I asked for help how to design the parser used in Marble to try to turn a text string into some geographical coordinates in such a way that it also can parse localized writings of such coordinates.

For those curious what came out of this, read on:

While I then forgot to mention the use-cases I was thinking of, like copying&pasting some pretty-printed string from some text, or entering the coordinates somebody tells you on the phone, still the broad feedback I got, both by those commenting on the blog post as well as those replying on the mailinglist of KDE’s translators (thanks to all of you), helped to accumulate quite some testing data, on which based the parser could be designed.

Well, it was done in a short rush, just in time for the translation soft freeze for the upcoming release of KDE Apps 4.8, but non-the-less can parse all of the testing data 🙂 Which means basically the parser can parse coordinates in these patterns, for all languages:

  • with latitude or longitude given as first
  • with directions given as prefix or postfix
  • with values given just as pure degree, as degree and minutes, or as degree, minutes and seconds
  • the last subvalue can optionally be in floating point precision
  • the first subvalue can be negative or positive, optionally with the + prefix
  • latitude and longitude can be separated by the “,” or the “;” character or simply white space
  • symbols for degree, minutes and seconds can be given or left out, if directions are given

The parser first tries to parse using the localized direction terms, than falls back to try the English ones. For the degree, minutes and seconds symbols it is quite tolerant, tries to understand all kind of character (combinations) people might try to express the symbols, using what their keyboard layout offers. Basic rule: if a human would get what is meant, so should the parser (e.g. two consecutive LEFT SINGLE QUOTATION MARKs ‘‘ would be accepted as seconds symbol). Additionally accepted would the localized variant of the symbol, like obviously typically found in non-latin based languages.

Additionally, for a very short notation, two pure floating point values, separated as described above, are parsed as first latitude degree and second longitude degree.

So also the Shorthand DMS notation, as hinted to by Kjetil Kilhavn, should be parsed without a problem. (Support for UTM is only worked on in Marble, no promises on when this might emerge)

For parsing of localized strings to work, the translators are asked to provide in the translation catalogs the information about additional local symbols for the degree, minutes and seconds, as well as how the directions are written. Per direction and symbol there can be multiple variants noted, so languages with variants of the direction terms are also covered. There is a short guideline for the translators, also linked from the strings in the code.

But things are not perfect yet:
only today I learned that Thai has a pattern which is not matching any of those described above, in that it also uses prefixes “longitude” and resp. “langitude” (in Thai) before those parts. Which is also the same pattern as with a sample I got for Icelandic, but I somehow had ignored that, only now found that entry marked as TODO.

So there are things left to do for the Marble version after the upcoming one. But then we all know, software is never finished 🙂

Perhaps the geographic coordinates localisation should also be added/moved to the general regional system settings, like Date & Time are, as coordinates become more and more used, due to mobile devices. So all programs dealing with coordinates would benefit and also be consistent (think KStars or Digikam).

Help needed: how to write geographic coordinates in $YOUR language?

As blogged about before, in KDE Apps 4.8 you will be able to enter geographic coordinates in Plasma Runner and then have Marble show it to you.

But there is a problem: the current code is only detecting coordinates where more or less the symbols for degree, minutes and seconds are °, , and and where the directions are given as a single word/letter (with letter the first letter of the word, like North, South, East and West in English).

But looking e.g. at the Wikipedia pages about London in some different languages, where the coordinates is given in the DMS format (degree-minutes-seconds), I can see that the parser will fail, perhaps:

Japanese: 北緯51度30分28秒 西経0度07分41秒
Persian: ‏۳۹″ ۷′ ۰°غربی ‏۲۶″ ۳۰′ ۵۱°شمالی
Russian: 51°30′26″ с. ш. 0°07′39″ з. д.
Czech: 51°30´25´´ s. š. 0°07´37´´ z. d.
Georgian: 51°30′00″ ჩ. გ. 0°07′00″ ა. გ.

(no idea why the center of London is different in each language 😉 ).

So, to support as many languages as possible and to know what is needed, could you please help me with yours?

Please post a comment with a sample how the geographic coordinates are constructed in your language, and which symbols for degrees, minutes and seconds are used and which terms to describe the directions?

Template to use:

Language (in English):
Degree symbol:
Minutes symbol:
Seconds symbol:
Term(s) for North:
Term(s) for South:
Term(s) for East:
Term(s) for West:
Some example(s) (e.g. London):

Examples could be also additionally in DM or D format.

Looking forward to many examples, best today/tomorrow 🙂

Enter geographic coordinates in Plasma Runner …

… and have them being shown in OpenStreetMap with Marble by just the press of the Enter key. You should be able to do so with the upcoming KDE Apps 4.8, due to the just merged commits.

Recently I was offered the geographic coordinates of a place used for a meeting, because none of the involved people was too familiar with the area. “Sure” I said, sitting in front of my computer, “I will just use Marble, pass them on”. And then failed in finding a way to have Marble take these coordinates and locate them on the map for me.

Given that all things looked to be in place and to just need some connecting (and slight fixing, as I found), for any possible next time I will now be able to just open the Plasma Runner, enter the coordinates…

… and then have the place shown to me in OpenStreetMap with Marble by the press of just one more key:

And so will you 🙂
Should work with degrees given as pure decimal values, as decimal and minutes, and as decimal, minutes and seconds (small bummer: needs fixing for non-western style languages, hopefully done in time for 4.8).

But I also start to have some geographic bookmarks in Marble, adding support for them was just a few more lines. So now just drop some part of the bookmark title or description to the Plasma Runner …

… and then have Marble show you the area again:

When I initially tried to tell Marble the coordinates I basically missed that I could have entered the coordinates in the “Navigation” panel on the right into the “Search” field. Maybe I even tried, but then the old coordinates string parser is quite restrictive in what he accepts, so maybe I had some wrong space char in my input. That is fixed now.

While looking at the Marble code I also learned that besides coordinates, places/building names, and (postal) addresses one can also enter IP addresses into the “Search” field, to have the assumed location of that IP address shown in the map. Surely not often needed, but handy if.

And if you have another idea what could be translated into a geographic position, you just need to write a dedicated Marble Runner plugin.

For KDE Apps 4.9 again I plan to have finished the support of those Marble Runners directly in the Plasma Runner, so one can search for places or addresses right there. Yes, including locations of IP addresses 🙂