open-meteo / geocoding-api

Search locations in any language worlwide
GNU Affero General Public License v3.0
15 stars 7 forks source link

Return english or native name if no local name is available #2

Closed jsteinaker closed 1 year ago

jsteinaker commented 1 year ago

Not sure if this is the right place to report this. I'm submitting patches to a small app that uses both the Weather and Geocoding API (thanks for your work, it's awesome!). The app makes use of the language parameter as described in https://open-meteo.com/en/docs/geocoding-api but the answer is not what I'm expecting.

For instance, take Bariloche in Argentina. Compare the results of https://geocoding-api.open-meteo.com/v1/search?name=Bariloche and https://geocoding-api.open-meteo.com/v1/search?name=Bariloche&language=es

In first case, we've got two results: the city itself, and the airport. If using language=es, only the airport is returned, and I assume this is because the first entry was never translated and so it's not present in the spanish database. Shouldn't the API return that result anyway, untranslated? What happens is if I'm using my own locale (spanish) I get way less results than I should (basically, every entry that's not translated is missing), even for locations with native spanish names. Given the task of translating every single location to every single language it's never going to be completed, I believe this should be the default behaviour.

jsteinaker commented 1 year ago

Nevermind. I found that Bariloche's full name is "San Carlos de Bariloche", and the short version (just "Bariloche") is not present on the database for Spanish (only for English, German and French, and it's set as preferred in those cases). Closing this, official reason is I don't investigate enough before reporting things I don't understand.

patrick-zippenfenig commented 1 year ago

In theory it would also be nice if the API finds "San Carlos de Bariloche" if just searched for "Bariloche". Currently the search index is not splitting up location names and extracts parts of it. Doing this, would increase the search index size by quite a lot.

Right now, the search index is optimised to stay below 4GB memory

jsteinaker commented 1 year ago

Thanks for answering Patrick. I've updated the record at Geonames so I guess it will be picked up soon. On a related note, the app I'm helping on has some basic type-ahead search functionality bundled. Is there currently any way to use the Geocoding API to search without making a new request every time the user press a new key? (keeping the connection open, one could say). Thanks!