User:John Cummings/Archive/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

Map
Anglesey and Pembrokeshire geomask
Map
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, Public Domain license or 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, however polygon data is available in other formats including .KML, .TopoJSON, and .CSV. These formats require conversion to GeoJSON before being added to Wikimedia Commons, GeoJSON.io 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 filesize 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 Geojson.io. Click 'Help' to learn how to use the tool.

  1. In the search bar (top right of the page) type Data:NAMEOFMAP.map replacing NAMEOFMAP with a descriptive name for your map, press enter.
  2. If the file already exists it will load the existing map, try another name to find one that isn't already taken.
  3. 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.
  4. Complete the description and source fields at the top of the template.
  5. On line 18, replace ... GeoJSON ... with your map data GeoJSON code.
  6. 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. In the example map data below (which example map below?), the coordinate has been used in this manner, with the longitude being before the comma (22.88116) and latitude after the comma (10.92391).
  7. 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.
  8. 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 proerty 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

Kartographer[edit]

To learn how to use Kartographer (the extension used to display the maps at the top of the page) see Help:Extension:Kartographer. ??Write on this page how to convert a Wikidata query into a Kartographer map??

Further reading[edit]