Template:Location map/doc

From TwentyOneWiki
Revision as of 15:48, 5 January 2024 by Template:Location map/doc>Duckmather (adding link to the sorted list I'm creating)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

[[Category:Template documentation pages{{#translation:}}]]

Lua error in Module:Location_map at line 526: Unable to find the specified location map definition: "Module:Location map/data/USA" does not exist.

The location map template generates a location map as a composite image, consisting of a map and a location mark. Optionally, a label and caption can be added.

Usage

Map image files are not accessed directly, but by using an auxiliary map definition. For example, if the first unnamed parameter supplied to this template is Japan, then this template uses the entry for Japan in Module:Location map/data/Japan if it exists, which contains the data needed to generate the composite image.

Please note

  • Assigning any value to the parameter |caption= causes the map to be displayed as a thumbnail image. If this parameter is not declared, the template will generate a default caption.
  • The coordinates are not checked. If the coordinates specified fall outside the area covered by the map image, the location mark will not display inside the image; however, it may be displayed somewhere else on the page.
  • Do not use px when setting the map image size. Using |width=200px will usually cause a very large map to be displayed. Use |width=200.
  • To create a map with more than one location mark, use either {{Location map+}} or {{Location map many}}.

Blank templates

Blank templates
Decimal degrees Degrees, minutes, seconds With {{Coord}}
(usually for infoboxes)
Wikidata
{{Location map|{{{1}}}
|width      = 
|float      = 
|border     = 
|caption    = 
|alt        = 
|relief     = 
|AlternativeMap= 
|overlay_image = 
|label      = 
|label_size = 
|position   = 
|background = 
|mark       = 
|marksize   = 
|link       = 
|lat_deg    = 
|lon_deg    = 
}}
{{Location map|{{{1}}}
|width      = 
|float      = 
|border     = 
|caption    = 
|alt        = 
|relief     = 
|AlternativeMap= 
|overlay_image = 
|label      = 
|label_size = 
|position   = 
|background = 
|mark       = 
|marksize   = 
|link       = 
|lat_deg    = 
|lat_min    = 
|lat_sec    = 
|lat_dir    = 
|lon_deg    = 
|lon_min    = 
|lon_sec    = 
|lon_dir    = 
}}
{{Location map|{{{1}}}
|width      = 
|float      = 
|border     = 
|caption    = 
|alt        = 
|relief     = 
|AlternativeMap= 
|overlay_image = 
|label      = 
|label_size = 
|position   = 
|background = 
|mark       = 
|marksize   = 
|coordinates= 
}}
{{Location map|{{{1}}}
|width      = 
|float      = 
|border     = 
|caption    = 
|alt        = 
|relief     = 
|AlternativeMap= 
|overlay_image = 
|label      = 
|label_size = 
|position   = 
|background = 
|mark       = 
|marksize   = 
}}

Parameters

Parameters
Parameter kind Parameter Description
Map display {{{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. See the examples below. Multiple maps can be shown by providing a list of map names separated by #. For multiple maps, the first is shown by default. A reader can select the others with radio buttons.
width Determines the width of the map in pixels, overriding any default values; do not include px. For example, use |width=300, not |width=300px.
default_width Determines the default width of the map in pixels, intended for use by templates, e.g. place infoboxes; the default value is 240. Do not include px. This value will be multiplied by the defaultscale parameter specified in individual map templates, if it exists, in order to achieve an appropriate size for vertical maps. For example, if |default_width=200 is given, a map of Thailand will be displayed with a width of 200×0.57=114 pixels (as specified in Module:Location map/data/Thailand).
max_width The maximum size of the map in pixels. Intended for use by templates, e.g. place infoboxes. Do not include px.
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 colour 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. Special value: infobox.
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 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 the map definition template. Multiple captions can be shown when separated by ## (that's two).
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. Other numerical values such as 2 or 3 will display image2 or image3, if those images are defined.
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[note 1] label The text of the label to display next to the identifying mark; a wikilink can be used. You can enclose the label inside of {{nowrap}} if you want to make sure that it stays on a single line. The default (if not specified) is no label, just the marker.
label_size The font size to use for the label, given as a percentage of the normal font size (<100=smaller, >100=larger); the default size is 90. Do not include %. For example, use |label_size=80, not |label_size=80%. If set to 0, the label is only displayed when the user hovers over the mark.
label_width The width to use for the label, given as an em size; the default width is 6. Do not include em. For example, use |label_width=7, not |label_width=7em.
position The position of the label relative to the identifying mark; valid values are left, right, top,bottom and none. This defaults to either left or right, depending on the coordinates of the marker and its position relative to the right border of the map image. When |position=none, any defined label will not be displayed with the mark, but it will be used to create the default caption.
background The background colour to use for the label; see Web colors. The default is no background colour, which shows the map image behind the label.
mark The name of an image file to display as the identifying mark; the default is Red pog.svg (). See examples at Commons:Location markers and Commons:Category:Map icons.
marksize The size of the identifying mark in pixels; the default is 8. Do not include px. For example, use |marksize=10, not |marksize=10px.
link Specifies a wikilink which can be followed if the reader clicks on the identifying mark; do not include [[]] (double square brackets). For example, use |link=Yellowstone National Park, not |link=[[[:Template:Zwsp]][Yellowstone National Park]].
coordinates The coordinates in {{Coord}} format.
Whilst not recommended, coordinates can also be entered in decimal degrees (e.g. 48.067°N 12.863°E); you shouldn't need to do this, though.
lat_deg 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.
lat_min The minutes of latitude.
lat_sec The seconds of latitude; not usually necessary.
lat_dir N for 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.
lon_deg 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.
lon_min The minutes of longitude.
lon_sec The seconds of longitude; not usually necessary.
lon_dir 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.
  1. If no coordinates are specified, the template will try to get them from the page's Wikidata item.

Available maps

Location map templates as of 5 Nov 2014. To find the best location map template covering a given place, open the SVG file in a web browser and use arrow keys and zoom function. Hovering over a region shows its name and highlights it. Clicking it loads its page.

There are over 1,000 maps available. To find other maps:

Creating new map definitions

See Creating a new map definition.

Examples

Default width and float, no label, default caption (decimal coordinates)

Note: when a label is not specified, the default caption is "Page name (Map name)", so if this example was viewed on a page named Pag, the default caption would be "Pag (Croatia)". Likewise, on a page named Pag (town), the default caption would be "Pag (town) (Croatia)". Lua error in Module:Location_map at line 526: Unable to find the specified location map definition: "Module:Location map/data/Croatia" does not exist.

{{Location map|Croatia
|alt     = Pag is on an island.
|lat_deg = 44.44
|lon_deg = 15.05
}}

Map with the default caption (degrees/minutes)

Note: when a label is specified, the default caption is "Label text (Map name)", seen as "Pag (Croatia)" in this example. Lua error in Module:Location_map at line 526: Unable to find the specified location map definition: "Module:Location map/data/Croatia" does not exist.

{{Location map|Croatia
|width = 200
|float = right
|alt = Pag is on an island.
|label = Pag
|position = right
|mark = Green pog.svg <!--green dot-->
|lat_deg = 44 |lat_min = 26 <!-- default: lat_dir = N -->
|lon_deg = 15 |lon_min = 3  <!-- default: lon_dir = E -->
}}

When |position=none, the label text is not displayed next to the mark, but is still used in the default caption and default alt text. Lua error in Module:Location_map at line 526: Unable to find the specified location map definition: "Module:Location map/data/Croatia" does not exist.

{{Location map|Croatia
|width = 200
|float = right
|label = Pag
|position = none
|mark = Green pog.svg <!--green dot-->
|lat_deg = 44 |lat_min = 26 <!-- default: lat_dir = N -->
|lon_deg = 15 |lon_min = 3  <!-- default: lon_dir = E -->
}}

Mark outside of map border, no caption

Lua error in Module:Location_map at line 526: Unable to find the specified location map definition: "Module:Location map/data/Croatia" does not exist.

{{Location map|Croatia
|width    = 200
|float    = right
|caption  =
|alt      = Rimini in Italy (outside the map)
|lat_deg  = 44.05
|lon_deg  = 12.57 <!--outside maps left border at 13.1-->
|outside  = 1 <!--we're aware the point is outside the map, so suppress the warning category-->
|label    = Rimini
|position = right
}}

Caption, label_size, background, mark, marksize

Lua error in Module:Location_map at line 526: Unable to find the specified location map definition: "Module:Location map/data/Italy" does not exist.

{{Location map|Italy
|width      = 200
|float      = right
|caption    = Location of Rimini in Italy
|alt        = Map of Italy with mark showing location of Rimini
|label      = Rimini
|label_size = 130 <!--130% of normal size-->
|position   = bottom
|background = #ffaa00aa <!--with opacity-->
|mark       = Orange_pog.svg
|marksize   = 12 <!--size in pixels-->
|lat_deg    = 44.05
|lon_deg    = 12.57
}}

AlternativeMap parameter

Lua error in Module:Location_map at line 526: Unable to find the specified location map definition: "Module:Location map/data/Italy" does not exist.

{{Location map|Italy
|AlternativeMap = Italy relief location map.jpg
|width   = 200
|float   = right
|caption = Location of Rome in Italy
|alt     = Map of Italy with mark showing location of Rome
|label   = Rome
|lat_deg = 41.9
|lon_deg = 12.5
}}

Relief parameter

When |relief= has no value, the module defined image is shown. Numerical values 1 to 99 will show image1 to image99. Any other value will show image1.

The following example also demonstrates automatic positioning of label to the left due to the far right position of the mark. Lua error in Module:Location_map at line 526: Unable to find the specified location map definition: "Module:Location map/data/Africa" does not exist.

{{Location map|Africa
|relief = yes
|caption = Location of [[Beyla]] in Africa
|label = Bandar Beyla
|label_width = 9
|lat = 9.5
|long = 50.8
}}

The second relief map from Module:Location map/data/Africa can be used by setting |relief=2 Lua error in Module:Location_map at line 526: Unable to find the specified location map definition: "Module:Location map/data/Africa" does not exist.

{{Location map|Africa
|relief = 2
|caption = Location of Beyla on a simulated [[land cover]] map of Africa 
|label = Bandar Beyla
|label_width = 9
|lat = 9.5
|long = 50.8
}}

User selection of multiple maps

Lua error in Module:Location_map at line 526: Unable to find the specified location map definition: "Module:Location map/data/UK Scotland" does not exist.

{{Location map|UK Scotland#UK
|relief = 1
|width = 180
|float = right
|caption = Lockerbie in Scotland, UK
|alt = Lockerbie is in southern Scotland.
|label = Lockerbie
|mark = Blue_pog.svg
|marksize = 9
|lat_deg = 55 |lat_min = 07 |lat_sec = 16 |lat_dir = N
|lon_deg = 03 |lon_min = 21 |lon_sec = 19 |lon_dir = W
}}

Multiple selectable maps in floating box

Template such as Template:Infobox settlement display the selectable radio buttons underneath the location map. The following code utilizes Template:Stack to achieve a similar result.

Template:Stack begin

Lua error in Module:Location_map at line 526: Unable to find the specified location map definition: "Module:Location map/data/Poland" does not exist.

Template:Stack end

{{stack begin}}
<div style="background:white; border:1px solid rgb(0, 0, 0); padding:2px; align:center; text-align:left; width:260; position:relative;">
{{Location map|Poland#Podlaskie Voivodeship#Europe#Baltic Sea#NATO
|relief        = Yes
|width         = 260
|default_width = 
|float         = 
|caption       = The [[Suwałki Gap]] is named after the city of [[Suwałki]] (marked by the blue dot).
|alt           = The city of Suwałki
|label         = Suwałki
|link          = Suwałki
|position      = 
|mark          = Blue_pog.svg
|marksize      = 6
|coordinates   = {{coord|54|05|56|N|22|55|43|E|region:PL_type:city|display=inline,title}}
|border        = infobox
|background    = 
}}
</div>
{{stack end}}

Map that crosses 180° meridian

Template:Category see also

Module:Location map/data/Russia Chukotka Autonomous Okrug is an example of a map that crosses the 180th meridian. To the west of 180° in the Eastern Hemisphere is Pevek, at 170°17′E longitude. To the east of 180° in the Western Hemisphere is Uelen, at 169°48′W longitude.

Lua error in Module:Location_map at line 526: Unable to find the specified location map definition: "Module:Location map/data/Russia Chukotka Autonomous Okrug" does not exist.

{{Location map
| Russia Chukotka Autonomous Okrug
| float       = right
| width       = 250
| caption     = [[Chukotka Autonomous Okrug]]
| label       = Pevek
| position    = bottom
| background  = lightgreen
| mark        = Locator_Dot.png
| marksize    = 7
| coordinates = {{coord|69|42|N|170|17|E}}
}}

Lua error in Module:Location_map at line 526: Unable to find the specified location map definition: "Module:Location map/data/Russia Chukotka Autonomous Okrug" does not exist.

{{Location map
| Russia Chukotka Autonomous Okrug
| float       = right
| width       = 250
| caption     = [[Chukotka Autonomous Okrug]]
| label       = Uelen
| position    = bottom
| background  = lightgreen
| mark        = Locator_Dot.png
| marksize    = 7
| coordinates = {{coord|66|09|N|169|48|W}}
}}

Template data

TemplateData documentation used by VisualEditor and other tools
See a monthly parameter usage report for Template:Location map in articles based on its TemplateData.

TemplateData for Location map

<templatedata> { "description": "This template places a location mark on a map.", "params": { "1": { "label": "Map name(s)", "type": "string", "required": true, "description": "The name of the map to be used; multiple maps can be provided as a list separated by \"#\"." }, "width": { "label": "Map width", "type": "number", "description": "Determines the width of the map in pixels, overriding any default values; do not include \"px\". For example, use \"width=300\", not \"width=300px\"." }, "default_width": { "label": "Default width", "type": "number", "description": "Determines the default width of the map in pixels, intended for use by templates, e.g. place infoboxes; the default value is 240. Do not include \"px\". This value will be multiplied by the 'defaultscale' parameter specified in individual map templates, if it exists, in order to achieve an appropriate size for vertical maps." }, "float": { "label": "Position", "type": "string", "description": "Specifies the position of the map on the page; valid values are \"left\", \"right\", \"center\" and \"none\". The default is \"right\".", "suggestedvalues": [ "left", "right", "center", "none" ], "default": "right" }, "border": { "label": "Border color", "type": "string", "description": "Specifies the colour of the map border; if set to \"none\", no border will be generated." }, "caption": { "label": "Map caption", "type": "string", "description": "The text of a caption to be displayed below the map; 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." }, "alt": { "label": "Alt text", "type": "string", "description": "Alt text for map; used by screen readers." }, "relief": { "label": "Alternative map from template", "type": "string", "description": "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. If more than one relief map is defined, \"2\" will display \"image2\", and so on." }, "AlternativeMap": { "label": "Alternative map not from template", "type": "string", "description": "Allows the use of an alternative map; the image must have the same edge coordinates as the location map template." }, "overlay_image": { "label": "Overlay image", "type": "string", "description": "Allows an overlay to be superimposed on the map; this parameter is seldom used." }, "label": { "label": "Marker label", "type": "string", "description": "The text of the label to display next to the identifying mark; a wikilink can be used." }, "label_size": { "label": "Label size", "type": "number", "description": "The font size to use for the label, given as a percentage of the normal font size; do not include \"%\"." }, "label_width": { "label": "Label width", "type": "number", "description": "The width to use for the label, given as an em size; do not include \"em\"." }, "position": { "label": "Label position", "type": "string", "description": "The position of the label relative to the identifying mark; valid values are \"left\", \"right\", \"top\", \"bottom\" and \"none\". This defaults to either \"left\" or \"right\", depending on the coordinates of the marker and its position relative to the right border of the map image. When \"position=none\", any defined label will not be displayed with the mark, but it will be used to create the default caption." }, "background": { "label": "Label background", "type": "string", "description": "The background colour to use for the label." }, "mark": { "label": "Marker image", "type": "string", "description": "The name of an image file to display as the identifying mark." }, "marksize": { "label": "Marker size", "type": "number", "description": "The size of the identifying mark in pixels; do not include \"px\"." }, "link": { "label": "Marker link", "type": "string", "description": "Specifies a wikilink which can be followed if the reader clicks on the identifying mark." }, "lat_deg": { "label": "Latitude degrees", "type": "number", "required": true, "description": "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." }, "lat_min": { "label": "Latitude minutes", "type": "number", "description": "The minutes of latitude." }, "lat_sec": { "label": "Latitude seconds", "type": "number", "description": "The seconds of latitude." }, "lat_dir": { "label": "Latitude direction", "type": "string", "description": "\"N\" for north or \"S\" for south of the Equator; not required if using signed decimal degrees." }, "lon_deg": { "label": "Longitude degrees", "type": "number", "required": true, "description": "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." }, "lon_min": { "label": "Longitude minutes", "type": "number", "description": "The minutes of longitude." }, "lon_sec": { "label": "Longitude seconds", "type": "number", "description": "The seconds of longitude." }, "lon_dir": { "label": "Longitude direction", "type": "string", "description": "\"E\" for east or \"W\" for west of the Prime Meridian; not required if using signed decimal degrees." }, "coordinates": { "label": "Coordinates", "description": "Coordinates, usually in Lua error in Module:Coordinates at line 611: attempt to index field 'wikibase' (a nil value). format; however, they can also be typed out in decimal degrees (with no spaces between \"°\" and \"N\"/\"S\"/\"E\"/\"W\").", "example": "Lua error: callParserFunction: function "#coordinates" was not found.", "type": "string" } }, "paramOrder": [ "1", "width", "default_width", "float", "border", "caption", "alt", "relief", "AlternativeMap", "overlay_image", "label", "label_size", "label_width", "position", "background", "mark", "marksize", "link", "coordinates", "lat_deg", "lat_min", "lat_sec", "lat_dir", "lon_deg", "lon_min", "lon_sec", "lon_dir" ] } </templatedata>


See also

Template:Commons Template:Commons category

For similar examples, see the documentation at Template:Location map+, as well as:

Location map templates

Other templates

Infoboxes incorporating Location map – any country or region Template:Location map/doc/See also infobox templates

Infoboxes incorporating Location map – specific countries or regions Template:Hidden