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

Overpass vs. Nominatim - different results #714

Open
dlubom opened this issue Jan 13, 2024 · 3 comments
Open

Overpass vs. Nominatim - different results #714

dlubom opened this issue Jan 13, 2024 · 3 comments
Labels

Comments

@dlubom
Copy link

dlubom commented Jan 13, 2024

Hello,

I’ve noticed that when I use this Overpass query (here’s the link: overpass turbo), which relates to tags for the country of Oman, it seems to return a complete list of tags.

[out:json];
relation(305138);
out tags;

However, when I perform a similar query on Nominatim, I get many more tags.

Nominatim Demo

For instance, it appears to be missing what seems like a key tag, “official_name:en” which is present on Nominatim but not on Overpass.

@ImreSamu
Copy link

ImreSamu commented Jan 13, 2024

For instance, it appears to be missing what seems like a key tag, “official_name:en”
which is present on Nominatim but not on Overpass.

The OSM API indicates that the relation with ID 305138 seems to lack the official_name:en key;

...   timestamp="2023-08-12T12:37:12Z"  ...
...
<tag k="name:zh-Hans" v="阿曼"/>
<tag k="name:zh-Hant" v="阿曼"/>
<tag k="official_name" v="سلطنة عمان"/>
<tag k="official_name:ar" v="سلطنة عمان"/>
<tag k="official_name:ckb" v="سەڵتەنەتی عومان"/>
<tag k="official_name:cs" v="Sultanát Omán"/>
<tag k="official_name:eo" v="Omana Sultanlando"/>
<tag k="official_name:pl" v="Sułtanat Omanu"/>
<tag k="ref" v="OM"/>
<tag k="state_code" v="OM"/>
<tag k="timezone" v="Asia/Muscat"/>
<tag k="type" v="boundary"/>
<tag k="wikidata" v="Q842"/>
<tag k="wikipedia" v="ar:سلطنة عمان"/>
...

EDIT:

As I see it, Nominatim might have automatically added the missing OSM tags from 'Linked Places'.

image

<node id="424315291" visible="true" version="80" changeset="135337586" timestamp="2023-04-25T10:46:35Z" 
...
<tag k="official_name" v="سلطنة عمان"/>
<tag k="official_name:ar" v="سلطنة عمان"/>
<tag k="official_name:be" v="Султанат Аман"/>
<tag k="official_name:br" v="Sultanad Oman"/>
<tag k="official_name:ca" v="Sultanat d'Oman"/>
<tag k="official_name:ckb" v="سەڵتەنەتی عومان"/>
<tag k="official_name:cy" v="Swltaniaeth Oman"/>
<tag k="official_name:de" v="Sultanat Oman"/>
<tag k="official_name:el" v="Σουλτανάτο του Ομάν"/>
<tag k="official_name:en" v="Sultanate of Oman"/>
<tag k="official_name:eo" v="Omana Sultanlando"/>
<tag k="official_name:et" v="Omaani Sultaniriik"/>
<tag k="official_name:eu" v="Omango Sultanerria"/>
<tag k="official_name:fr" v="Sultanat d'Oman"/>
<tag k="official_name:id" v="Kesultanan Oman"/>
<tag k="official_name:it" v="Sultanato dell'Oman"/>
<tag k="official_name:lb" v="Saltanat Uman"/>
<tag k="official_name:lt" v="Omano Sultonatas"/>
<tag k="official_name:pl" v="Sułtanat Omanu"/>
<tag k="official_name:pt" v="Sultanato do Omã"/>
<tag k="official_name:ro" v="Sultanatul Oman"/>
<tag k="official_name:ru" v="Султанат Оман"/>
<tag k="official_name:sr" v="Султанат Оман"/>

@lonvia
Copy link
Contributor

lonvia commented Jan 14, 2024

Yes, Nominatim tries to link up administrative boundaries to an appropriate place node and then mixes in the name tags from the place into the response. The linking is somewhat involved. If you want to do it in Overpass, the best strategy is to look for a node with a place tag and the same wikidata tag. No idea if that is possible with OverpassQL. You can also use Nominatim's lookup endpoint to retrieve the extended information given an OSM relation ID. Use namedetails=1.

@mmd-osm
Copy link
Contributor

mmd-osm commented Jan 15, 2024

If you want to do it in Overpass, the best strategy is to look for a node with a place tag and the same wikidata tag. No idea if that is possible with OverpassQL

If you're lucky and the place node is a relation member, the query is pretty fast:

(
  relation(305138);
  node(r)[place][wikidata](if:t["wikidata"] == u(t["wikidata"]));
);
out;

Checking all place/wikidata nodes is much slower:

(
  relation(305138);
  node[place][wikidata](if:t["wikidata"] == u(t["wikidata"]));
);
out;

Since Overpass returns the original OSM objects, you need to merge relation / node tags locally in a post-processing step.

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

No branches or pull requests

5 participants