pelias / api

HTTP API for Pelias Geocoder
http://pelias.io
MIT License
221 stars 162 forks source link

return 2-letter ISO country codes #1540

Closed missinglink closed 3 years ago

missinglink commented 3 years ago

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.

missinglink commented 3 years ago

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

Screenshot 2021-06-24 at 15 58 24