From OpenStreetMap Wiki
Jump to navigation Jump to search

Wikidata is a free knowledge base driven by a community and hosted by the Wikimedia Foundation. As well as providing a repository for linked, open data, it aims to support Wikipedia and its sibling projects (such as Wikivoyage) by providing a centralized database, from a single tag wikidata=*. Like Wikipedia, anyone can edit Wikidata. Wikidata data is provided under a CC0 ("public domain") licence. Note that importing data from Wikidata into OSM is generally not feasible due to copyright incompatibilities (see that section for details).

Linking from OSM to Wikidata


In OpenStreetMap Wikidata entities can be linked on every kind of osm object using the wikidata=* key. An other way to link objects is by using wikipedia=*. Wikidata tags are language independent though and only OSM objects (areas) with wikidata tags are highlighted in infoboxes in Commons etc. Tools like WIWOSM are supporting this way. With wikidata tag, data can be easily checked with the Wikidata+OSM SPARQL query service, which could show any discrepancies and errors.


wikidata=* item identifiers can be added to OSM elements by using:

  • The ID online editor – see “Connecting OpenStreetMap and Wikidata” (Mapbox blog post).
  • The JOSM editor with these additional plugins:
    • JOSM/Plugins/Wikipedia – has a button to query Wikidata and can open a selected Wikidata item in browser.
      Note that coordinates can be copied directly from within JOSM to a Wikidata item; just select an appropriate node, press Ctrl+ Shift+C then paste to the “Geographical coordinates” field of the item.
    • JOSM/Plugins/Tag2Link – open Wikidata item in browser.
  • OSM Wikidata Explorer – visualize distance between OSM and Wikidata coordinates (data doesn't appear to have been updated since summer of 2017).
  • OSMgadget – a Mediawiki gadget to pull in OSM data while viewing Wikipedia.
  • – detects possible matches and allows quickly adding them to OSM.

Validation tools:

Note that in certain cases, wikidata=* should be used as a suffix of another key. For example, if you want to link an OSM shop to the Wikidata object of the brand, you can use brand:wikidata=*; a statue can be tagged artist:wikidata=* and subject:wikidata=*, etc.

Wikidata user scripts

Several user scripts on Wikidata allow to query and render an OSM-derived map for specific items in Wikidata matching OSM elements:

  • Overpass” – adds to a Wikidata item page a map showing features tagged in OSM with their Wikidata item identifier.
  • MapView” – displays an OSM-derived map on Wikidata item page with coordinates.

Linking from Wikidata to OSM

OSM tags and keys

For a list of OSM tags’ and keys’ equivalent items in Wikidata, see what links to Property:P1282.


Wikipedia, etc.

Wikimedia Foundation projects, including each language’s Wikipedia, are now displaying maps using OSM data. If an entity in OSM has been tagged with a Wikidata ID, its outline can be highlighted on the map. At the moment, there is no POI support. Only shapes and lines can be shown this way. See w:mw:Help:Extension:Kartographer#GeoShapes external data.

Do note though that doublet Wikidata items regularly are created and then later discovered and merged and one of them (usually the younger) then becoming a redirect. If the Wikidata ID tagged on an OSM object is such an redirect, said objects will no longer be highlighted on Wikimedia maps.



Reasonator, which puts a human-friendly front end on Wikidata, is now showing two links for geotagged entries, to TagInfo and Overpass turbo, querying these tags.

For example, the Reasonator page:

has links to:

You’ll see them just below the map images.

Why link to Wikidata?

Sir Tim Berners-Lee devised the “Five stars of open data”, the fifth, and highest, level of which is “link your data to other data to provide context”. By including a Wikidata ID (which software understands as a URI), in an OSM object (and indeed in a tag-definition page on the OSM wiki), we link that object to an object (item) on Wikidata, and from there, directly and indirectly, to items in many other systems. That makes OSM part of the Linked Open Data graph, rather than an isolated system, separate from it.

More pragmatically, it allows anyone querying OSM to retrieve additional data, and links to other databases, about an OSM object, which OSM does not store. That might, for example, be the population of a town, both current and various periods in its history, or the birth date and place of the architect of a building, and their portrait, or a link to a system showing the last week’s rainfall in a nature reserve. Not to mention, in time, more complex queries, like “all the scientific papers written by people born in this village, sorted by how many other papers cite them”.

The Kartographer extension binds OSM objects to their Wikipedia article when the object has a wikidata=* tag, see for example this article map in the infobox.

Querying Wikidata and OSM

Wikidata data can be retrieved in a number of ways, one of which is SPARQL. Since OSM data can also be queried using SPARQL, Wikidata “federates” the two, allowing them to be queried jointly.

Specific OSM-based services which Wikidata federates with include:

Importing data

Importing data from OSM into Wikidata

Copying data from OSM to Wikidata (or even from other Wikimedia projects) is not allowed because Wikidata uses the public-domain style Creative Commons CC0 license which does not contain any attribution or share-alike provisions.

Note Wikimedia legal team advice confirms this: For EU databases, bots or other automated ways of extracting data should also be avoided because of the Directive’s prohibition on “repeated and systematic extraction” of even insubstantial amounts of data. (from w:m:Wikilegal/Database Rights#Conclusion).

Importing data from Wikidata into OSM

Wikidata is using the CC0 license, which on first sight allows imports into OSM. However, OSM does not, generally, accept imports of data from Wikidata due to the sources often used to contribute to Wikidata. A significant part of Wikidata data was harvested from Wikipedia, in which for example most coordinates are produced using/copied from products with licenses conflicting with OSM.

For example copying from Google Maps to OpenStreetMap (even indirectly) is not OK, and copying Wikidata coordinates (that were copied to Wikipedia from Google Maps) is also not OK. Note that Wikipedia allows and encourages to use Google Maps to obtain coordinate data[1] and other sources that are not OK to be used in OSM[2].

The same applies for any other data present in Wikidata.

Import are OK only for Wikidata content that was imported from sources compatible with OSM - what excludes for example coordinates obtained from Wikipedia.

OpenStreetMap tries to be whiter than white, and data should be legally usable in any country[3]. Therefore OpenStreetMap acknowledges sui generis database right. As a conclusion, an import of information from Wikidata into OSM is generally not permitted because Wikidata has lower standards in terms of copyright than OSM. In addition, Wikidata contains some data from sources we are not allowed to use[4].

In rare situations, when it is possible to verify that data has acceptable copyright status it is possible to use part of Wikidata data.

OSM wiki templates to create links to Wikidata pages

  • {{Q}} – display a link to a Wikidata item by its unique (hopefully stable) identifier.
  • {{Property}} – display a link to a Wikidata property by its unique (hopefully stable) identifier.

Past activities

  • 2013-09-12: There was a proposal to automatically add Wikidata IDs to a number of OSM objects.
  • 2016-10-27: Mapbox has proposed a procedure for importing, but has yet to get community feedback on it and thus reverted in the meantime.
  • 2016-11-17: There has been a Mapbox inspired mass-edit but has also been put on hold until further community discussion.


OSM elements tagged with Wikidata item unique identifiers can be displayed in Wikipedia pages, as overlays on OSM-based maps, using the Kartographer Extension. See also Kartographer/OSM.

Academic papers about OSM

Wikidata has details of academic papers about OSM. They can be seen at Scholia.

See also

Notes and references