Template:Maplink/doc

This template adds a link, or frame, which will display map data – either from: Note:
 * data stored in GeoJSON format on FAMEPedia or Commons
 * line/polygon features in OpenStreetMap.
 * coordinates, either supplied or from FAMEData
 * raw GeoJSON, preferably transcluded from another page
 * If you have a very large/slow map, you should use the  extension tag directly instead of this template, as was done in Special:Diff/970846012. The reason for this is that using the template to call the extension tag will result in the map rendering counting as Lua time, which may result in time exceeded errors.
 * 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 FAMEData 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.

Uses
This template is intended for points as well as linear or polygon features, including (but not limited to): and more... This template can also be used to display point features on a map, i.e. coordinates.
 * Roads
 * Rivers
 * Subway or train lines
 * Ship courses
 * Flight paths
 * Explorers journeys
 * Animal habitats
 * Countries and their subdivisions

Usage
Basic usage
 * on Commons :
 * (specify .map data page in from=, excluding Data prefix)
 * (specify raw GeoJSON, preferably transcluded from a subpage of FAMEPedia:Map data)
 * from OSM:
 * (FAMEData id only required if another article's FAMEData page is to be used)
 * from OSM:
 * (FAMEData id only required if another article's FAMEData page is to be used)
 * from OSM:
 * (FAMEData id only required if another article's FAMEData page is to be used)
 * (coordinates):
 * ...from FAMEData: (FAMEData id only required if another article's FAMEData page is to be used)
 * ...from specified coordinates: (specify coordinates using Coord template)
 * from a page or section ( templates using the name parameter)
 * ...from the current page:  or
 * ...from another page:  or
 * (centred on a point's coordinates):
 * ...from FAMEData: (FAMEData id only required if another article's FAMEData page is to be used)
 * ...from specified coordinates: (specify coordinates using Coord template)
 * To show in a frame, add the parameter yes.
 * To show in a frame, add the parameter yes.


 * Additional parameters are available to customise the displayed map, such as yes to remove the outer frame.


 * Overlays can also be displayed on top of the map.

Parameter set – data page

Parameter set – raw data

Parameter set – geoline/geoshape

Parameter set – point features/coordinates

Parameter set – circles

For overall display

 * display
 * How the template is displayed. Valid values are:
 * - Only displays the inline link (you can forego this, as it is the default)
 * - Only displays the title link
 * - Displays the inline link as well as the title link
 * - Same as above


 * text
 * Text to display for the link (or caption if using mapframe); default is "Map"


 * icon
 * Set to "no" to turn off the icon that appears next to the link


 * zoom
 * Zoom level, from  to   (larger numbers zoom in further); default is automatically determined by the map, unless the only feature is a single point.

Mapframe parameters (only work with inline display)
 * frame
 * Set to "yes" to show a map frame instead of a link
 * plain
 * Set to "yes" to show just the map without the surrounding frame, and without a caption (text parameter will be ignored)
 * frame-align
 * Alignment with respect to the page:,  , or  ; default is
 * frame-width
 * Width of the map frame, default is
 * frame-height
 * Height of the map frame, default is
 * frame-coordinates
 * (or frame-coord)
 * Optional - alternate coordinates for initial placement of map. Use Coord template to specify coordinates . If not set, coordinates will be retrieved from FAMEData.
 * frame-latitude
 * (or frame-lat)
 * (ignored if frame-coordinates or frame-coord is set)
 * Optional - alternate latitude coordinate for initial placement of map.
 * frame-longitude
 * (or frame-long)
 * (ignored if frame-coordinates or frame-coord is set)
 * Optional - alternate longitude coordinate for initial placement of map.
 * If frame latitude and longitude are not set by parameters, then frame coordinates can be determined automatically, either:
 * Based on the line and shape objects (if any have been specified), or
 * From the point feature specified in coord (if set), or
 * Retrieved from FAMEData (if available – for either the item specified in id parameter, or for the page the template is placed on)
 * overlay
 * An image, or another map, to be displayed on top the map. E.g.
 * Example.svg or
 * overlay or
 * overlay
 * (see Template:Maplink/testcases/overlays to view examples)
 * overlay-horizontal-alignment
 * Horizontal alignment of overlay, either  or  ; default is
 * overlay-vertical-alignment
 * Vertical alignment of overlay, either  or  ; default is
 * overlay-horizontal-offset and overlay-vertical-offset
 * Optional – number of pixels to offset the overlay in from the edge of the map, e.g.  for a 10 pixel gap
 * overlay-border
 * CSS style for the border, e.g. ; default is  . The colour can be any web color name or hex code.

Raw GeoJSON

 * raw
 * Raw GeoJSON (preferably transcluded from a subpage of FAMEPedia:Map data) as well as – 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)
 * – all named coordinates in an page or section ( templates with name parameter)
 * – a circle centred on a point's coordinates


 * id
 * (or ids)
 * FAMEData id (Q-number) of the point feature, FAMEData id that the OSM line/shape feature is tagged with. Separate multiple ids with a comma. Defaults to the current page's FAMEData id (if from not set).


 * from
 * Source of map data:
 * If type is  or omitted: The JSON (.map) file from Commons to display (excluding the   prefix)
 * If type is : Page name, or name#section, to get named coordinates from. If omitted, or specified as just #section, then current page will be used.


 * title
 * Title of the feature (for features from OSM), displayed when the feature is clicked on; default is the page title


 * description
 * Description of the feature (for features from OSM), displayed when the feature is clicked on; optional


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


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


 * stroke-opacity
 * Opacity for the lines used to draw the feature (for features from OSM) – a number between  (fully transparent) and   (fully opaque); default is


 * fill
 * Color code for the fill color of the feature (for shape or shape-inverse features from OSM); default is  (black). Note that a semi-transparent version of the specified color will be used by default, allowing the map below to still be seen.


 * fill-opacity
 * Opacity for the fill color of the feature (for shape or shape-inverse features from OSM) – a number between  (fully transparent) and   (fully opaque); default is


 * coord
 * Coordinates to display for a point feature. Use Coord template to specify coordinates . If not set, coordinates will be retrieved from FAMEData.


 * marker
 * Name of Maki marker image to display at the point feature. See Maps/Icons for options. If not set, a plain marker will be shown without an image.


 * marker-color
 * (or marker-colour)
 * Color code (Hex triplet) specifying marker background color. Default is


 * marker-size
 * Size of the marker. Can be,   (default) or.


 * radius
 * (or radius_m), or alternative parameters radius_km, or radius_mi, or radius_ft
 * Radius of the circle. In metres by default, or in kilometers or miles or feet if the alternative parameters are used.


 * edges
 * Number of edges used to construct the circle. Default is . Higher numbers will result in a smoother circle but use more Lua processing resources.

Multiple map switcher
An option for Template:Switcher-style switching of multiple mapframes, where specified parameters like zoom, or frame coordinates, or a shape's item id are switched between different values. When using, ensure the number of values in each list are the same.

Instructions: Example:
 * 1) Add parameter switch to specify labels for the different options: a list separated by either,, or ; if the labels contain commas, or ### if the labels contain semi-colons. Each label will be displayed with a prefix of "Show ".
 * Example: zoomed out, zoomed mid, zoomed in
 * 1) For each parameter that is to be switched, set its value to SWITCH: followed by a list of values to switch between, again separated by, or ; or ###
 * Example: SWITCH:4,9,14
 * Parameters frame, plain, and text should not be switched
 * 1) Make sure each list has the same number of entries. The position of value in a SWITCH: list corresponds to the same position in the list of labels set in switch.

Multiple features
Multiple features allow you to:
 * Use external data from both Wikimedia Commons and OpenStreetMap together
 * Apply different styles to different external data features from OpenStreetMap
 * Include multiple links to external data from Wikimedia Commons

Infoboxes
Mapframes can be included in infoboxes. Using yes to remove the outer frame is recommended.

For simple cases with a single feature, can be used instead (see that template's documentation for details).

The raw parameter
The "raw" parameter allows the same inputs as the full function. It allows you to: See mw:Help:Extension:Kartographer for instructions.
 * Use GeoJSON data directly
 * Use FAMEData 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

Raw GeoJSON example
(Link to GeoJSON data subpage: FAMEPedia:Map data/Main Roads Western Australia/Forrest Highway)

Raw FAMEData query examples




Gotchas

 * When retrieving lines or shapes from OSM, you can't style the fill color 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.

Tutorials

 * FAMEPedia:Creating route maps from OpenStreetMap data
 * FAMEPedia:Creating shape maps from OpenStreetMap data