Wikidata:Map data

From Wikidata
Jump to navigation Jump to search

Map data is geographical information stored as points, lines or polygons on a map which describes a physical area. It can store information for current and historical political boundaries, geological boundaries, species distribution maps etc and Earth, other planets and even fictional places. Map data can be used to display information in Wikidata queries and Kartographer maps. Map data is stored in Wikimedia Commons and can be linked to Wikidata items using geoshape (P3896), further information is available at MediaWiki Map Data.

There are 4 steps to using map data:

  1. Find a map data file
  2. Import the file into Wikimedia Commons
  3. Link the map data file to the Wikidata item
  4. Use map data in Wikidata queries and Kartographer maps

Note: Maps on this page are displayed using Kartographer, see below for details

Anglesey and Pembrokeshire geomask
Cardiganshire geomask

Find map data[edit]

Note: Wikimedia Commons accepts the following licenses for map data: CC-BY (v1,2,3 or 4), CC-BY-SA (v1,2,3 or 4), ODbL, CC0, or Public Domain; as well as content that does not meet the minimum threshold of orginality for copyright. See here for more information.

Map data files on Wikimedia Commons use the .GeoJSON file format. Polygon data can also be available in other formats, including .KML, .TopoJSON, and .CSV. These formats require conversion to GeoJSON before being added to Wikimedia Commons. Both and can be used to create, convert, and edit map data. You can find map data files at many sources, including:

Note: Wikimedia Commons has a file size limit of 2MB for GeoJSON files.

Import the map data into Wikimedia Commons[edit]

Note: Wikimedia Commons does not have a visual editor for map data, you can check or edit the data on a map (adjust the boundaries, change the colour, move the shape) using Click 'Help' to learn how to use the tool.

  1. Go to Wikimedia Commons
  2. In the search bar (top right of any page) type replacing NAMEOFMAP with a descriptive name for your map, press enter.
  3. If the file already exists it will load the existing map, try another name to find one that isn't already taken.
  4. Once you have found a filename that is free click Create the page "" on this wiki! (making sure NAMEOFMAP is replaced with your file name) and a page with instructions and code will be displayed.
  5. Complete the description and source fields at the top of the template.
  6. On line 18, replace ... GeoJSON ... with your map data GeoJSON code.
  7. Correct the centering of map by entering latitude and longitude values. Unless a very exact centering is required, it will be sufficient to take these data from the first coordinate in the geojson.
  8. Set the zoom at an appropriate level to display the map data by entering a number between 0 and 19 on line 5, e.g. "zoom": 4,. There are twenty zoom levels with 0 being the lowest, displaying the entire planet, and getting closer to the surface at each increment. The level is displayed in the Wikimedia maps URL after /#. For example, is set at 0.
  9. Click Publish page at the bottom of the page to create the file.

Note: Examples of map data files include Japan, Wakefield, Highway 1 in Israel and Leeds School of Medicine.

Link the map data to the Wikidata item[edit]

Carew Castle (Q752721) is an example of an item with a map data file, a full list of the items with the property geoshape (P3896) are available here. To Add a map data file to a Wikidata item:

  1. Go to the Wikidata item that corresponds to the map data file.
  2. Use geoshape (P3896) and add the name of the map data file in Wikimedia Commons as the value.

Note: To learn how to add statements please see Wikidata:Tours

Use map data in Wikidata queries and Kartographer maps[edit]

See also: Wikidata:Wikidata in Wikimedia projects

Wikidata Queries[edit]

Note: Instructions to learn how to create Wikidata queries are available here

Map data can be displayed in Wikidata queries by first defining the subject with a map data file, for example a country, and then including a statement with the geoshape property as the predicate (needs some help here). To query map data for countries the syntax is:

     ?item wdt:P31 wd:Q6256 .
     ?item wdt:P3896 ?geo .

The first line defines the item as a country and the second clause states that the country has a map data file.

Need to work out what to do with this bit


To learn how to use Kartographer (the extension used to display the maps at the top of the page) see Help:Extension:Kartographer.