Template:Location map many

From Wikiversity
Jump to navigation Jump to search
Template documentation[view] [edit] [history] [purge]

Template:Location map many creates a location map as a composite image of an existing map, with multiple markers and optional labels superimposed onto it. This template functions in the style of Template:Location_map, but allows multiple markers and labels (rather than just one marker).

For an unlimited list of markers/labels, see: Template:Location map+, which specifies points as a coded template list of markers/labels.


The first unnamed parameter (shown as {{{1}}} below) specifies a map definition. If {{{1}}} is Spain, the map image and coordinates are based on the values defined for Spain in Module:Location map/data/Spain if it exists, or in Template:Location map Spain otherwise.

{{Location map many
| {{{1}}}
| width       = 
| float       = 
| border      = 
| caption     = 
| alt         = 
| relief      = 
| AlternativeMap = 
| <!--first label/marker-->
| label1      =  <!-- or: label -->
| label1_size =  <!-- or: label_size -->
| position1   =  <!-- or: position, pos1, pos -->
| background1 =  <!-- or: background, bg1, bg -->
| mark1       =  <!-- or: mark -->
| mark1size   =  <!-- or: marksize -->
| link1       =  <!-- or: link -->
| lat1_deg    =  <!-- or: lat_deg -->
| lat1_min    =  <!-- or: lat_min -->
| lat1_sec    =  <!-- or: lat_sec -->
| lat1_dir    =  <!-- or: lat_dir -->
| lon1_deg    =  <!-- or: lon_deg -->
| lon1_min    =  <!-- or: lon_min -->
| lon1_sec    =  <!-- or: lon_sec -->
| lon1_dir    =  <!-- or: lon_dir -->
| <!--second label/marker-->
| label2      = 
| label2_size = 
| position2   =  <!-- or: pos2 -->
| background2 =  <!-- or: bg2 -->
| mark2       = 
| mark2size   = 
| link2       = 
| lat2_deg    = 
| lat2_min    = 
| lat2_sec    = 
| lat2_dir    = 
| lon2_deg    = 
| lon2_min    = 
| lon2_sec    = 
| lon2_dir    = 
| <!--repeat as needed up to 9-->


Map display parameters
Parameter Description
{{{1}}} Required. Use the name of the map as the first unnamed parameter. For example, specifying England will use the values for England in Module:Location map/data/England if it exists, or {{Location map England}} otherwise. See the examples below.
width Determines the width of the map in pixels. The default is 240. Do not include px, for example: width=300, not width=300px.
float Specifies the position of the map on the page. Valid values are left, right, center and none. The default is right.
border Specifies the color of the 1px map border. The default is lightgrey (see web colors). If set to none, no border will be generated. This parameter is seldom used.
caption The text of a caption to be displayed below the map. Specifying a caption will cause the map to be displayed with a frame. If caption is defined but is not assigned a value, the map will not be framed and no caption will be displayed. If caption is not defined, the map will not be framed and a default caption will be generated. The default caption is created from the label parameter (or the current page name if label not defined) and the name parameter from map definition template. See the examples below.
alt Alt text for map; used by screen readers, see WP:ALT.
relief Any non-blank value (1, yes, etc.) will cause the template to display the map specified in the map definition template as image1, which is usually a relief map. See the example at Location map+/relief.
AlternativeMap Allows the use of an alternative map. The image must have the same edge coordinates as the location map template. See the example at Location map+/AlternativeMap.
overlay_image Allows an overlay to be superimposed on the map. This parameter is seldom used. See the example at Location map+/overlay.
Label and mark parameters
Parameter Description
The text of the label to display next to the mark. A wiki link can be used. The default if not specified is no label, just the marker.
The font size to use for the label, given as a percentage of the normal font size (<100 = smaller, >100 = larger). The default is 90. Do not include %, for example: label_size=80, not label_size=80%.
The position of the label relative to the mark. Valid values are left, right, top and bottom. The default is right.
The background color to use for the label. See Web colors. The default is no background color, which shows the map image behind the label.
The name of an image to display as the mark. The default is Red pog.svg (Red pog.svg). See examples at Commons:Location markers and Commons:Category:Map icons.
The size of the mark in pixels. The default is 8. Do not include px, for example: marksize=10, not marksize=10px.
Specifies a wiki link which will be followed if the reader clicks on the mark. The name of the linked article is displayed when the mouse pointer hovers over the mark.
Required. The degrees of latitude. This value can be specified using decimal degrees and when this format is used minutes and seconds should not be specified.
The minutes of latitude.
The seconds of latitude. Usually not necessary.
N if north (default value) or S for south of the Equator. Other values will be disregarded. Not required if using signed decimal degrees (i.e. negative numbers for southern latitude).
Required. The degrees of longitude. This value can be specified using decimal degrees and when this format is used minutes and seconds should not be specified.
The minutes of longitude.
The seconds of longitude. Usually not necessary.
E for east (default value) or W for west of the Prime Meridian. Other values will be disregarded. Not required if using signed decimal degrees (i.e. negative numbers for western longitude).

Note: For brevity, parameters "pos" & "bg" are aliases (for "position" & "background"), with pos2, bg2, pos3, bg3, etc.


When a marker's mark#size=0, then that marker is skipped and only the related label is displayed, without the marker.

Each mark, mark2, mark3 (etc.) can be another image-symbol, such as Diamond_sheer_red_20.gif (marksize=20) to show a red diamond on the image: Diamond sheer red 20.png or use: Cercle_rouge_100%.svg to show a red circle Cercle rouge 100%.svg or a larger black diamond: Diamond_sheer_black_37.gif as sized with a larger marksize=37 or similar number to resize the diamond somewhat: Diamond sheer black 37.png

See Wikimedia pointer symbols: commons:Category:Map pointers.

Advisory messages[edit]

The degrees of latitude/longitude are validated, to show error messages, but location minutes can be set very large to place markers outside the map (with no warnings). Due to the numerous details of specifying multiple markers/labels, the latitude and longitude are checked to lie within the actual map limits specified in Template:Location_map_<parameter1>. Each marker/label is checked and can list a warning message (under the map), such as:

Latitude#4 (45.68) < map min(53.74).

Processing continues, with that marker actually placed off-map, and all latitude/longitude parameters are checked. Only degrees of latitude/longitude are checked, so a value of 63 minutes would be valid to indicate 1 extra degree + 3 minutes, and setting lon_min=200 could still place a marker off-map (right-side) with no warning message. Also, large markers or long labels can spill over the edges of a map, allowing markers to point inward from outside the map. In such cases, a map could be centered by itself on the page ("float=center") to avoid overlapping the edge markers onto any surrounding article text.

Available maps[edit]

Location maps can be found using these sources:

Special:PrefixIndex/Module:Location map/data/ - Checked before a map template is searched for. New maps should be created here rather than creating new templates.
List of templates - 1050 templates available when the list was generated.
Category:Location map templates - templates sorted by category.
Special:WhatLinksHere/Template:Location map/Info - a search that might help.
Special:Prefixindex/Template:Location_map_ - another search that might help.

Creating new map definitions[edit]

See Creating a new map definition.

Implementation notes[edit]

The map with markers/labels is implemented as nested HTML divisions. The map-image is in an HTML division, containing each point as a percent-locator division containing a marker-image sub-division plus a label sub-division. Each point is calculated (for a percent-locator division) with X or Y coordinate "XX.X%" or "YY.Y%" as follows:

  • The div-tag is "<div style="position: absolute; z-index: 2; top: XX.X%; left: YY.Y%; ...>"
  • For placing latitude, the calculation is:
  • XX.X% = 100 * (top - (lat_deg + latmin/60 +latsec/3600) ) / (top - bottom)
  • If lat_deg is empty, the combined decimal latitude is used from "lat".
  • If lat_dir is "S" (south), the latitude is multiplied by -1.
  • (Note latitude is positioned in reverse, from top of map downward.)
  • For placing longitude, the calculation is:
  • YY.Y% = 100 * ( (lon_deg + lonmin/60 +lonsec/3600) - left ) / (right - left)
  • If lon_deg is empty, the combined decimal longitude is used as "long".
  • If lon_dir is "W" (west), the longitude is multiplied by -1.
  • The div-tag is ended as "height: 0; width: 0; margin: 0; padding: 0;">".
  • Within that division the marker/label sub-divisions are coded as:
  • <div style="position: relative text-align: center; ...">.
  • For label position, the options are shifted as:
  • when position=left, adds "left: -6.5em; text-align: right;"
  • when position=right, adds "left: 0.5em; text-align: left;"
  • when position=top, adds "top:-2.65em; left:-3em; text-align: center;"
  • when position=bottom, adds "top:-0.15em; left: -3em; text-align: center;" to div-tag.

See also[edit]