Where is the algorithm or table that "resolves" the OLC short code?

Viewed 296

Many geocodes, such as Geohash and OLC (Open Location Code), can be reduced by a context reference, as described here and here.

For example:

Being able to say WF8Q+WF, Cape Verde, Praia is significantly easier than remembering and
using 796RWF8Q+WF

The resolver software take "Cape Verde, Praia" (or ISO abbreviation CV instead Cape Verde) and transforms it into a code prefix... The resolver make use of something like a lookup table,

Prefix | Country | Name (replaces prefix) | Reference is it?
-------+---------+------------------------+------------------
796R   | CV      | Praia                  | 796RWFMP ?
796R   | CV      | Joao Varela            | 796RXC4C ?
797R   | CV      | Cruz do Gato           | 797R3F38 ?
...    | ...     | ...                    | ...

I am supposing that the hidden (black box) algorithm do something simple, based on an official lookup table like the illustrated above. It use prefix of the lookup table to translate short code into complete code, or the inverse:

  • Translating short code to complete code. To retrieve the location from the OLC short code, just know the prefix.
    Example: "WF8Q+WF, CV, Praia " will use the line of CV | Praia of lookup table, that informs the prefix 796R to resolve the code, concatenating prefix with suffix, "796R" with "WF8Q+WF".
    It is like a function
    recoverNearest('WF8Q+WF', getReferencePoint_byText(lookup,"CV", "Praia"))
    but Google/PlusCodes not published lookup dataset of Cape Verde.

  • Translating complete code to short code. To show the short code from location (e.g. from 796RWF8Q+WF), is necessary to check the "nearst reference" to resolve the spatial query — Joao Varela and Praia lines have same prefix, but Praia's reference, by 796RWF, matches better.
    It is like a function
    shorten('796RWF8Q+WF', getReferencePoint_byNearFrom(lookup,'796RWF8Q+WF'))
    but Google/PlusCodes not published lookup dataset of Cape Verde.

Question: where official lookup table of Cape Verde?

NOTES

We can split in more questions to generalize:

  • Is plus.codes really a black box?
    (perhaps I am using some wrong hypothesis on my explanation)

  • The lookup table of a country like Cape Verde exist, and we can download it? where Google is publishing it?

  • The official lookup table of Cape Verde exists and Google is respecting it... where Cape Verde govern is publishing it?


More illustrations for readers that not understand the central problem:

  • Translation from complete code to short code. Suppose the prefix 796R, when a complete code 796Rxxxx+yy is translated to "Praia xxxx+yy" and when is translated to "Joao Varela xxxx+yy"?
    It is an arbitrary choice if you not have a table with the PlusCode official references.

  • Translation from short code to complete code. Suppose that I am developing a Javascript software. The inputs are the short code xxxx+yy and a name (country and city or contry/state/city/district). Suppose only Cabo Verde country names, how to convert names into prefixes exactly as PlusCodes?


(edit after discussions) A preliminary conclusion. There are only two possible answers to the question:

  1. show a link where PlusCodes published its name-to-prefix table;

  2. show the source-code of an algorithm that reproduces exactly PlusCodes, that you developed by reengineering.
    I supposed that the most simple algorithm use the ordinary OLC encode/decode, and a parser for translate names into prefixes (or vice-versa), based in an "official lookup table".

1 Answers

Open Location Code is just another form of standard geographic coordinate: latitude and longitude. So, to get OLC for any place you need only geo coordinates for this place (see encoding section) and vice versa.

With database of Cape Verde towns and their coordinates you can build your own lookup table for quick OLC transformation with any required precision (starting from Wikipedia List of cities and towns in Cape Verde or using any of free world cities databases) or you can just convert OLC to latitude and longitude and than work with this coordinates.

Related