feat(localNames): prefer local names in lookup #318
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
👋 I did some awesome work for the Pelias project and would love for everyone to have a look at it and provide feedback.
Here's the reason for this change 🚀
This allows the PIP-Service to return administrative names in the local language. It seems this feature was started and pushed to the master branch in this commit in 2017. This 2017 commit involves adding a local boolean parameter called
localizedAdminNames
, which if set totrue
extracts the local name from the WOF dataset. However, I noticed some issues:false
value here. I do not know why this was done. I am guessing because the feature was incomplete and not tested?localizedAdminNames
is converted to the string data type when passed into a forked child worker process here. This leads to the correct if-branch never being taken here.Here's what actually got changed 👏
schema.js
to include the parameterimports.adminLookup.localizedAdminNames
inpelias.json
. Default is set tofalse
to be backward compatible.index.js
and passed downstream.bool
->string
type changelocalizedAdminNames
experiences across process boundaries insrc/pip/worker.js
Here's how others can test the changes 👀
I tested this by updating PIP-Service to point to my fork. I then manually rebuilt the docker image. I then used the following
pelias.json
file:and the following
docker-compose.yml
:When you start up
pip
it will take some time (~3-5 min) to build the in-memory spatial index. Afterward you can query the service as so:curl http://localhost:4200/2.320957/48.871326
. You should see a response as so:We also did these tests on about 50K different GPS points in France and got a 90% exact match with our existing french-named locality lookup using a Nominatim instance. A sampling of the reaming 10% seem to be minor neighborhood differences (still in French).
Possible Concerns
We did not test the world. There could be edge cases where this breaks? I also have concerns about why the feature was not enabled in the first place. Maybe I missed something?