Jon's Wiki Wikipedia


From Jon's Wiki


Here's how to add a map to a Wikipedia article, using the Transmission Gully Motorway map as an example.

Get some data out of OpenStreetMap

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 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

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,

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

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

Then make this change in the Wikipedia article - it was in the middle of an infobox template, but see Template: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
+    | zoom = 10
+    | text = Map of the Transmission Gully motorway
+    | frame = yes | frame-width = 290 | frame-height = 260 | frame-align = center
+  }}
+  | map_custom = yes