User:Jonathanischoice/maps
Maps
[edit]Here's how to add a map to a Wikipedia article, using the Transmission Gully Motorway map as an example. Well, it's how I figured out how to do it, anyway. Documentation is either sparse, out of date, doesn't exist, or is perhaps just very hard to find. There's probably a simpler way, but I haven't discovered it yet.
Get some data out of OpenStreetMap
[edit]Firstly, query OpenStreetMap for line objects with a "name" key with a value of either "Transmission Gully Motorway", "Waitangirua Link Road", "Whitby Link Road", or "Kenepuru Link Road". You can do this using query2map, e.g. [1] [2] [3] [4]
Then look in the source for each of these pages, and grab the URL in the JavaScript API call that fetches KML from the query server, and save the URL response directly as a KML file (it should contain XML).
Go to geojson.io and drag-and-drop your KML file(s) onto the map. Then save it as a GeoJSON file.
Add the map data to Wikimedia Commons
[edit]Next, create a new map data page on Wikimedia Commons. These are in the "Data:" namespace, end with .map and contain raw GeoJSON data. For example, https://commons.wikimedia.org/wiki/Data:Transmission_Gully_motorway.map
Paste the contents into the new map page where indicated, and choose the Open Database license that OpenStreetMap uses for its data.
Point Wikidata at the map data
[edit]Go into Wikidata and find the thing you want to map - in this case, Transmission Gully Motorway. Add the geoshape property, and give it the name of your new Commons map data page. It should try and look it up for you.
You may also need to add a coordinates location property as well, which should correspond to the centre of the feature.
Update the Wikipedia article
[edit]Then make this change in the Wikipedia article - it was in the middle of an infobox template, but see {{Maplink}} for more info.
- | map = TransmissionGully.png - | map_alt = Map of the route of the Transmission Gully Motorway - | map_notes = The route of the Transmission Gully Motorway. + | map = {{mapframe + | from = Transmission Gully motorway.map + | zoom = 10 + | text = Map of the Transmission Gully motorway + | frame = yes | frame-width = 290 | frame-height = 260 | frame-align = center + }} + | map_custom = yes