pelias / api

HTTP API for Pelias Geocoder

Home Page:http://pelias.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

return 2-letter ISO country codes

missinglink opened this issue · comments

One of the most common workflows when consuming the GeoJSON is to do something depending on the country.
The ISO 3166-1 alpha-2 standard seems to be the most widely adopted, although we use the alpha3 version historically.

Currently it's a little difficult to do this cleanly and requires the consumer to figure out if it's a country or a dependency (or child thereof) and then call a library which maps the 3 letter alpha3 to an alpha2, checking for the *_a field.

What I'm proposing is that we handle this complexity on the server-side and return an ISO 3166-1 alpha-2 value with all records.

There would be some similarity with how we handle the ISO standard for languages:

Screenshot 2021-06-24 at 15 58 24