User:Planemad/Kartographer maps workshop
Workshop to create maps with Kartographer at WikidataCon Berlin.
- Date: Sunday 29 October 2017
- Venue and Time: Room 'E' 12.30-13.30PM
- 1 Workshop
- 2 Creating Wiki maps using OSM data
The goal of the workshop is to walthrough how Wikidata and OpenStreetMap data can be connected to easily create interactive maps on Mediawiki projects. The workshop makes use of the Extension:Kartographer which is available by default on the Wikivoyage project. The example may not working on other Wikimedia projects without the extension.
The Wikimedia Map service is the primary provider of open maps for Wikimedia Projects. The service consists of a zoomable street level map of the world generated using data from the OpenStreetMap Project.
The OpenStreetMap Project is the largest source of crowdsourced geographical data. It takes a few minutes to sign up and improve the map of your home neighborhood using the online map editor called iD via the  button. One can add or improve any type of map feature like roads, buildings, trees and even trash cans.
This make OSM the ideal database to store open map data. The data is licensed under the ODbL license which allows data reuse with attribution and share alike.
OSM Data structure
Every map feature is defined as shape (points, lines, areas) and some metadata (`key`=`value` pairs) called tags. This allows adding defining a full geographical feature like a street with its shape and properties like road type, width, multilingual and even a Wikidata reference.
- Use taginfo to find commonly used tags for the feature you want to map
Connecting OSM data and Wikidata
Adding Wikidata ids to OSM
Adding Wikidata tags to OSM map features helps link map features on the OSM database to their associated item on the Wikidata database. This allows:
- querying a map feature from OSM based on a Qid
- adding extra metadata form Wikidata to map features like language labels
Adding OSM ids to Wikidata
Adding OSM ids to Wikidata is not encouraged since the OSM ids can change as the shapes are merged or split often. Relation ids are more stable and can be added using Property:P402
Creating Wiki maps using OSM data
Now that we have updated map data on the OpenStreetMap Project with Wikidata links, it can be used to embed interactive maps on Mediawiki sites with a few lines of code. There are two ways to do this:
The easiest way to create a map with a shape highlighted from OSM is to use the Kartographer extension. The extension helps to query a shape from OSM using a Qid or a SPARQL query
A mapframe will create and embedded map while a maplink will open the map in a popup.
Type and service
You can set the data to overlay on the map using the `type` and `service` parameter.
- type:feature for directly defining geojson shape
- type: ExternalData to fetch the shape from an external source like OSM (service:geoshape or geoline) or commons (service:page)
QID to be updated:- http://overpass-turbo.eu/s/mRF
- Constituencies for the election to the German Bundestag 2017, with winning candidate and party
Generate GeoJSON from OSM
Using Overpass Turbo to query OSM for features with a certain tag or feature id and export to a GeoJSON.
- Lookup the feature with a certain wikidata id http://overpass-turbo.eu/s/sFh