User:John Cummings/Map data

From Wikidata
Jump to navigation Jump to search

Issues

Noun Project Map icon 1463108.svg

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


Correct the centre on number 3, make 2 and 3 into transcluded pages like 1, there's something weird happening with the loading, also it will make the page less scary to edit. Also the links on maps 2 and 3 don't work properly, they link to Wikidata pages but not Q numbers, the links in number 1 work


Churches & abbeys in Yorkshire
Depicted in the Welsh Landscape Collection
Noun Project shapes icon 1040349.svg

Find map data[edit]

This should probably be on Commons with a link here

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

Noun Project import icon 652774.svg

Import the map data into Wikimedia Commons[edit]

This should probably be on Commons with a link here

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.

Noun Project link icon 415104.svg

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

Noun Project Drawing Compass Icon 202981.svg

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