Hacker News new | ask | show | jobs
by Alupis 4347 days ago
Any reference to how they came up with any given Map Code? Like how 52.508957, 4.769173 became US-AK 81.J4W?

I see they have come up with them for all locations, but how can I take a given coordinate and surmise it's MapCode, or the reverse (without their API or website)?

1 comments

Goal #3 on their list was:

> A conversion need not just be based on formulae. A respectable amount of data may be used as part of an algorithm.

Which is why when you go to the downloads page, you'll find sources in C, JavaScript and Java, but they all include "data tables".

There are a few other restrictions, though it's somewhat unclear how relevant they are here without inspecting the tables closer:

> One such limit is to use only rectangular areas in our definitions. Another is to limit the size of the “context” data table to about 16,000 records.

So it's not something you can do without the data tables. And for ease of use, they have disambiguation routines for country/state input.

Hmm, I just took a look at their Java SDK... (clearly just sample code, but intended for embedding into your project to get going quickly)

They make a lot of assumptions, and a lot of hard-coded values.

For example, they seem to have lots of city names and country names hard-coded into a giant String array. ISO country codes are hard-coded (probably a safe assumption so-long as new countries are not added), many "magic numbers".

Overall, I think these things are acceptable... but I don't necessarily like relying on the assumptions that "things today should be the same tomorrow". With plain old coordinates, my software would never care if the ISO added new country codes or what-have-you.

I see they intent this to be mainly for human consumption -- but is US-AK 81.J4W really any more memorable than 52.508957, 4.769173? I'd probably end up writing both down personally, which means the coordinates would suit me just fine.

81.JW4 is a lot easier to tell someone over the phone or transcribe from a business card or billboard, and it's pretty unlikely that the US-AK part would be ambiguous in those contexts. And if it is, a simple "which 81.JW4 did you mean?" would probably disambiguate pretty effectively.
Well, phonetically, pure numbers are better.

It's much harder to hear "eight" and mistake it for another number, but "P" and "T" are commonly confused (presumably people would read it as "Papa" and "Tango" to avoid confusion). What about "O" and "0", "I", "l", "1", etc. Now we have ambiguities that may not be interpreted correctly, even with phonetics.

FWIW they left O and I out of the list of possible letters for just that reason.

One could argue either way about fully-numeric versus alphanumeric codes. They're a bit harder to communicate but more than three times shorter, on average.

Edit: math is hard. One and a half times shorter, on average.