Wikidata:Map data
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:
- Find a map data file
- Import the file into Wikimedia Commons
- Link the map data file to the Wikidata item
- Use map data in Wikidata queries and Kartographer maps
Note: Maps on this page are displayed using Kartographer, see below for details
Find map data
editNote: 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 Mapshaper.org and GeoJSON.io can be used to create, convert, and edit map data. You can find map data files at many sources, including:
- DataHub
- Free GIS Data
- Natural Earth Data
- OpenStreetMap (see instructions to import from OSM into Wikimedia Commons)
Note: Wikimedia Commons has a file size limit of 2MB for GeoJSON files.
Import the map data into Wikimedia Commons
editNote: 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 Geojson.io. Click 'Help' to learn how to use the tool.
- Go to Wikimedia Commons
- In the search bar (top right of any page) type Data:NAMEOFMAP.map replacing NAMEOFMAP with a descriptive name for your map, press enter.
- If the file already exists it will load the existing map, try another name to find one that isn't already taken.
- Once you have found a filename that is free click Create the page "Data:NAMEOFMAP.map" on this wiki! (making sure NAMEOFMAP is replaced with your file name) and a page with instructions and code will be displayed.
- Complete the description and source fields at the top of the template.
- On line 18, replace ... GeoJSON ... with your map data GeoJSON code.
- 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.
- 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,https://maps.wikimedia.org/#0/-65/488
is set at 0. - 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
editCarew 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:
- Go to the Wikidata item that corresponds to the map data file.
- 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
editSee also: Wikidata:Wikidata in Wikimedia projects
Wikidata Queries
editNote: 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
Kartographer
editTo learn how to use Kartographer (the extension used to display the maps at the top of the page) see Help:Extension:Kartographer.