Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Report: Increase the importance of individual OSM node in Nominatim and Photon #58

Open
leonardehrenfried opened this issue Sep 23, 2021 · 0 comments

Comments

@leonardehrenfried
Copy link
Contributor

leonardehrenfried commented Sep 23, 2021

We want to experiment with manually modifying the ranking of places returned by Photon. In our concrete example the search for "Ahrensburg" returns the city of Ahrensburg and then the two subway stations, but not the main train station - at least not ranked high enough. This is because the train station doesn't have a wikidata or wikipedia tag.

Therefore we want to experiment with manually changing the importance.

Connecting to the Nominatim DB

If you're ssh'ed into the host infrastracture.stadtnavi.eu you can use the following command line to connect to the nominatim DB:

psql -h localhost -p 5432 -U nominatim

The password required is in the ansible vault but is visiable in decrypted form in the file /etc/systemd/system/nominatim.service.

IntelliJ

If you have the professional version of IntelliJ you can also use that for inspecting the database. For this you need to set up SSH tunneling in the UI.

Screenshot from 2021-09-23 11-14-17
Screenshot from 2021-09-23 11-14-13

Queries

If you want to find your way around a little, you could use the following queries:

-- Ahrensburg West (U-Bahn)
select * from placex where osm_id = 6233764950;

-- Ahrensburg Ost (U-Bahn)
select * from placex where osm_id = 5196118052;

-- Ahrensburg (Deutsche Bahn)
select * from placex where osm_id = 3205295000;

Setting the importance

In the queries and in the Photon debug output you can see that the two subway station have a score of ~0.31. We want to set the importance to something above that.

(Hamburg main station has an importance of ~0.46, by the way.)

The following query will set the wikipedia tag to the one of the city of Ahrensburg. and set the indexing status to 2, meaning Photon will know that it needs to import the row:

update placex set extratags = extratags || hstore('wikipedia', 'en:Ahrensburg'), indexed_status = 2 where osm_id = 3205295000;

During Photon's import it also sets the indexed_status and this will retrigger a computation of the importance.

Updating Photon

Now that we have updated the DB we can then trigger a Photon reimport with:

sudo systemctl start photon-update.service

You this will return immediately as it only triggers the HTTP call to start the import. You can view the progress in the log with

journalctl -u photon -f

If you have only a few rows to import then it should complete within seconds.

Result

Searching for Ahrensburg will lead to the train station being ranked highest.

Screenshot from 2021-09-23 12-33-29

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant