Template:Mapbox/doc

This template adds a box to the right of the page, which includes a link to display map data – either from: Note:
 * data stored in GeoJSON format on Commons
 * line/polygon features in OpenStreetMap.
 * coordinates, either supplied or from Wikidata
 * raw GeoJSON, preferably transcluded from another page
 * GeoJSON files cannot currently be directly uploaded. Instead, on Commons, create a page that is in the  namespace and ends in   – see mw:Help:Map Data for further information.
 * To make OpenStreetMap (OSM) features available, add the Wikidata key to the OSM relation (and wait 1 or 2 days) – see mw:Help:Extension:Kartographer and mw:Help:Extension:Kartographer/OSM for further information.

Usage
utilises Template:Maplink. As a result, usage of the two templates is very similar.

Full parameter set – data page

Full parameter set – raw data

Full parameter set – OSM features

Full parameter set – point features/coordinates

Multiple links
Up to five links can be included within the one box by adding "2", "3", "4" or "5" to the end of the parameter name - e.g. or. All parameters support this except for,   and. Unlike the first link (where it is optional), the  parameter is required for links 2-5.

Parameters affecting the maps

 * type
 * Type of data. Valid values are:
 * – a geoline feature from OSM (e.g. a road)
 * – a geoshape feature from OSM (e.g. a state or province)
 * – a geomask feature from OSM (the inverse of a geoshape - allows an unobstructed view of the map beneath)
 * – a geoJSON data page on Commons (parameter is optional in this case)
 * – a point feature (coordinates)


 * id
 * (or ids)
 * Wikidata id (Q-number) that the OSM feature is tagged with. Separate multiple ids with a comma. Defaults to the current page's Wikidata id (if from not set).


 * from
 * The JSON (.map) file from Commons to display (excluding the  prefix)


 * raw
 * raw GeoJSON (preferably transcluded from a subpage of Map data) as well as (plain marker) if not set.


 * stroke-color
 * (or stroke-colour)
 * Colour code for the colour used to draw the feature (for features from OSM); default is


 * stroke-width
 * Width for the lines used to draw the feature (for features from OSM); default is


 * zoom
 * Zoom level, from  to   (larger numbers zoom in further); will be automatically determined if not set

Parameters affecting the box

 * above
 * Content (such as explanatory text) appearing above the links


 * below
 * Content (such as explanatory text) appearing below the links


 * text
 * Text to display for the link; default is "View map"


 * text-left
 * Set this to  to change the link text from centre-aligned to left-aligned

When to use the raw parameter
The "raw" parameter allows the same inputs as the full function. It allows you to:
 * Use GeoJSON data directly
 * Use a combination of data sources together (direct GeoJSON, external data from Wikimedia Commons and external data from OpenStreetMap)
 * Have more options for directly styling data (data from Commons will inherit the styling specified in the .map page)
 * Include multiple pieces of external data from Wikimedia Commons
 * Use Wikidata queries to obtain information for the map
 * Use templates - if a map includes direct GeoJSON or many components, placing the data in a template will avoid cluttering the article text

Gotchas

 * When retrieving lines or shapes from OSM, you can't style the fill colour or the opacity level of fills or strokes (unless you use the raw parameter).
 * The following code utilising the raw parameter won't work because the curly brace to close the GeoJSON is adjacent to the curly braces to close the template:
 * To fix it, put a space before the two template braces or move them to a separate line.


 * Maplink's multiple features functionality doesn't work; use raw instead.