pelias / wof-admin-lookup

Who's on First Admin Lookup for the Pelias Geocoder
https://pelias.io
MIT License
9 stars 24 forks source link

Configure countries to use for postal city lookup #305

Open NairolfL opened 3 years ago

NairolfL commented 3 years ago

Hello, I've been trying this wof admin lookup with different pelias importers (mostly openstreetmap / openaddresses). I may be missing something but it seems impossible to configure which country to use for the postal city lookup. It seems that the country list is hard coded at : https://github.com/pelias/wof-admin-lookup/blob/master/src/postalCityMap.js#L53

Would it be possible to make this configurable ? Or is it already and I missed it ? I see that data exists for a lot of countries already.

orangejulius commented 3 years ago

Hi @NairolfL, You're right, it's probably harder to edit that list than it needs to be. Especially because it's buried in a dependency of the importers, rather than the importers themselves.

We use the pelias/config module to allow changing all sorts of options within Pelias, and this would be a good candidate for that sort of thing.

NairolfL commented 3 years ago

Hi @orangejulius

Thanks for you quick response. Would you accept a merge request if I take some time to update it ?

orangejulius commented 3 years ago

Absolutely, that would be great!

I think if you name the config option imports.adminLookup.postalCitiesCountries and allow it to be an array of any length, that would be nice. It would line up well with some of our existing config options like the directory configuration (which is not documented).

You can keep the defaults currently in the file if the parameter is empty, otherwise it should load files if it exists. I think we can limit it to only 3-character country codes to keep things simpler.

If you have any other questions let us know, or feel free to open an early draft PR for review.

NairolfL commented 3 years ago

Hello @orangejulius, I did a first draft of the change. I tested it with the openaddresses importer and it worked. It defaults to the previous values so it shouldn't break anything. I have a few questions :

Thank you !