Shortcut: WD:OSM
Wikidata:OpenStreetMap
Overview | Tools | Related documents |
This page is about Wikidata's collaboration with OpenStreetMap (Q936) (OSM). We particularly welcome OSM contributors who are new to Wikidata! We recommend you read our general introduction, first. Below, some examples of what you can do.
Coordinates in Wikidata
[edit]We add coordinates to items in Wikidata using coordinate location (P625). See, for example Q2191338#P625.
Note that due to copyright incompatibility issues it is not possible to import coordinates from OpenStreetMap to Wikidata. It also applies to importing coordinates from Wikipedia that were added there based on OpenStreetMap data. See this link for more details.
Linking from Wikidata to OSM
[edit]Because OSM IDs are not stable, and based on suggestions from the OSM community, we do not recommend adding a property for OSM IDs to Wikidata (this has been attempted in the past). Instead, add Wikidata key to OpenStreetMap and link to that. (see. Overpass API: Permanent ID)
If wikidata key is set then in other than main and property namespaces you can use {{Overpasslink}}
for linking to OpenStreetMap:
{{Overpasslink|Q539324}}
→ Ludwigskirche (Q539324) in OpenStreetMap
Linking from OSM to Wikidata
[edit]See the Wikidata key on the OSM wiki. For example, the OSM object https://www.openstreetmap.org/way/37716925 is tagged wikidata=Q2191338 - meaning Birmingham Town Hall (Q2191338).
It is also possible to use the well-established wikipedia key to link to Wikidata via an associated Wikipedia article.
Howto
[edit]- login (you can use a Wikimedia account for login by selecting Wikimedia under the Alternatively, use a third party to login title in the login screen).
- Find the object that you want to edit (most likely by using search in left side of screen).
- If you have selected the target object before you clicked edit AND the object is small and zoom level is high then editor will show it directly.
- Add the Wikidata tag in the edit window.
- If the tag is there already then it is under "all tags" -list.
- Save the changes
Example video:
Tools
[edit]- Main page: Wikidata:OpenStreetMap/Tools
User scripts
[edit]- GeoHack replacement script (source) – replaces coordinates' external links to GeoHack with direct links to a single mapping provider (for example, OSM).
- overpass[1] (source) – embeds a map displaying features tagged with the current item in OpenStreetMap. Powered by Overpass Turbo (Q62057787).
- ClaimMaps[2] (source) – adds maps to OpenStreetMap relation ID (P402) or geoshape (P3896) statements
- osm.js[3] (source) – adds a link to OSM in Tools section of an item page
- Tool matching wikidata and OSM objects
- https://osm.wikidata.link/ detects possible matches and allows quickly adding them to OSM
- Combined database with both Wikidata and OSM data
- Sophox query service combines both databases, and allows querying them using the same tool as Wikidata Query Service itself.
- Wikidata Extractor
- https://rene78.github.io/Wikidata-Extractor/ - A tool to extract Wikidata IDs from OpenStreetMap, given an Overpass Turbo query
Linking from Wikipedia to OSM
[edit]Overpass
[edit]After adding Wikidata tags to OSM objects, how to find them once again? The answer is Overpass Turbo (Q62057787). It's a tool to query OSM data. Overpass shows the results nicely on a zoomable map. Writing queries for it, is a bit tricky though. That's where this module comes in:
OSM Lua Module (Please click through to see the documentation)
With a minimum of parameters, it allows to generate queries related to the article it's invoked from.
Query
[edit]Here is an example of two queries to list the department of France (Q6465), their ISO 3166-2 code (P300), Wikidata ID and OSM ID :
from the Wikidata side (with Wikidata Query Service (Q20950365)) | from the OSM side (with Overpass Turbo (Q62057787)) link |
#French départements with Name, Wikidata ID, OSM relation ID, and ISO 3166-2 code
SELECT ?name (?item as ?wikidata) ?osm ?code WHERE {
?item wdt:P31 wd:Q6465; # French départements
wdt:P300 ?code. # with ISO 3166-2 code
OPTIONAL { ?item wdt:P402 ?osm. } # OSM relation if available
SERVICE wikibase:label {
bd:serviceParam wikibase:language "fr".
?item rdfs:label ?name.
}
}
|
/* French départements with Name, Wikidata ID, OSM relation ID, and ISO 3166-2 code */
[out:csv("name","wikidata",::id,"ISO3166-2")];
rel["admin_level"="6"]["ISO3166-2"~"^FR-..$"];
out;
|
The Sophox (Q55840137) query tool also exists and allows for querying OSM, the OSM wiki and Wikidata.
Mix'n'match catalogs
[edit]- OpenStreetMap Relations catalog
- OpenStreetMap Wiki keys, tags and relations catalog
- New South Wales suburb OSM catalog
Importing data from OSM
[edit]Copying data from OSM to Wikidata is not allowed because Wikidata uses the public-domain style Creative Commons CC0 license which does not contain any attribution or share-alike provisions required by the ODBL-licensed OSM data.
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 Meta).
Importing data from Wikidata into OSM
[edit]Copying data from Wikidata into OSM is also generally not allowed - see OpenStreetMap:Wikidata#Importing_data for details. It is caused by OpenStreetMap acknowledging sui generis database rights and because large part of Wikidata was harvested from sources incompatible with OSM legal requirements.
OSM-related properties on Wikidata
[edit]- OpenStreetMap relation ID (P402)
- OpenStreetMap tag or key (P1282)
- OpenStreetMap zoom level (P6592)
- OSM Name Suggestion Index ID (P8253)
- OpenHistoricalMap relation ID (P8424)
- OpenStreetMap numeric user ID (P8754)
- Humanitarian OpenStreetMap Tasking Manager project ID (P8973)
- OpenStreetMap way ID (P10689)
- OpenStreetMap node ID (P11693)
Further information
[edit]- Page about Wikidata on the OSM wiki
- WIWOSM - (Wikipedia where in OSM), a project to show for a Wikipedia article geometric objects from OpenStreetMap
- User:Pigsonthewing's proposal to automate the addition of Wikidata IDs to objects in OSM
- Wikidata for relevance? - GitHub ticket for using Wikidata data for rankings in Nominatim, an OSM tool.
- Videos
- OpenStreetMap - what is it and what does it mean for Wikimedians? - talk at Wikimania in 2014
- Wikidata for Mappers - Talk at State of the map US, on 2015
Discussion spaces
[edit]See also
[edit]- Wikidata:Map data
- Template:User OSM - Userbox for OpenStreetMap contributors.
References
[edit]- ↑ Copy the following code, click here, then paste:
{{subst:iusc|1=User:Mxn/overpass.js}}
- ↑ Copy the following code, click here, then paste:
{{subst:iusc|1=User:Teester/ClaimMaps.js}}
- ↑ Copy the following code, click here, then paste:
{{subst:iusc|1=User:Abbe98/osm.js}}
|