OSM id is said to be unstable which is not a good reference. This is also the reason that they are not suggested to be added on Wikidata. Therefore, query on Wikidata will not give us OSM ids.
OSM does have awikidata tag. Our query will receive it if available. The problem is how to get it.
In practice, none of our place have this wikidata tag.
For example, using OSM Nominatim to search by geocodings, one of our queries returns the following data :
which has a different osm_type ("way") compared with querying Beijing on OSM ("boundary").
Our current query strategy about OSM is: if the space_name string can be found in the display_name tag of OSM, we say it is a match. There is actually a risk that if it is a mismatch like Nanjing Road can be in the city Shanghai which can match either Nanjing or Shanghai. (This is a risk that I just found and I am considering how to fix it).
However, no matter if we are matching the string or if we modify the script to match the other tags like state or country, we can't link this OSM data to a wikidata id if there is no wikidata tag. Because we are not sure if it should be linked to the wikidata id of Beijing or China. (And Dongcheng District in semantic is not a city.)
I found a tool on GitHub. But it violates our idea that we try to minimize the dependencies, right?
OSM id is said to be unstable which is not a good reference. This is also the reason that they are not suggested to be added on Wikidata. Therefore, query on Wikidata will not give us OSM ids.
OSM does have a
wikidata
tag. Our query will receive it if available. The problem is how to get it.In practice, none of our
place
have thiswikidata
tag.For example, using OSM Nominatim to search by geocodings, one of our queries returns the following data :
which has a different
osm_type
("way") compared with querying Beijing on OSM ("boundary").Our current query strategy about OSM is: if the
space_name
string can be found in thedisplay_name
tag of OSM, we say it is a match. There is actually a risk that if it is a mismatch likeNanjing Road
can be in the cityShanghai
which can match eitherNanjing
orShanghai
. (This is a risk that I just found and I am considering how to fix it).However, no matter if we are matching the string or if we modify the script to match the other tags like
state
orcountry
, we can't link this OSM data to awikidata id
if there is nowikidata
tag. Because we are not sure if it should be linked to thewikidata id
ofBeijing
orChina
. (AndDongcheng District
in semantic is not acity
.)I found a tool on GitHub. But it violates our idea that we try to minimize the dependencies, right?