Template:Location map

被永久保护的模板
维基百科,自由的百科全书
文档图示 模板文档[查看] [编辑] [历史] [清除缓存]

基于现有采用等距圆柱投影的地图来创建一幅地理位置图作为自创图像,同时可以在其上进行标示并选择性地叠加标签。需要注意的是:

  • 使用“caption=xxx”可以给地图加上外边框(缺省的“caption=”则保留地图的无边框状态)
  • 标示和标签不会去检查经度和纬度的有效性,并且有可能被置于页面的任何位置,甚至超越页面底部
  • 要忽略标示,可以设置marksize=1,即1个像素的宽度
  • 地图需要设置宽度,例如“width=250”(省略输入“px”),否则图像将会拉伸至整个页面
  • 要放置多个标示和标签,请参看
  • 要沿着汇合的经线做映射,请参考:Template:Location_map_skew

使用方法

Location map在美国的位置
Location map
黃石公園在美國西北部的位置
十進制度 度、分、秒
{{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    = 
}}

可用地圖

模版{{Template:Location map location}}的列表(省略了前缀“Template:”):

说明:若需要更多列表,请前往Special:PrefixIndex/Template:Location_map_并点击右上角的“下一页”。

同时可以参阅Category:地理位置圖模板(现时还很不完整,但对于一些子类很有用)。

建立新地圖步驟

  1. 找到一幅合适的使用等距圆柱投影的空白地图
  2. 以「Template:Location map location」的名稱建立模板(可從其他地圖模板複製過來,並輸入相關數據)

參見:創建一個新地圖模版英语Template:Location_map/Creating_a_new_map_definition

範例

带默认说明的地图(度/分)

位於島上的帕格
位於島上的帕格
Location map (克罗地亚)
{{Location map | Croatia
| alt     = 位於島上的帕格
| lat_deg = 44 | lat_min = 26
| lon_deg = 15 | lon_min = 3
}}

带默认说明的地图(十进制坐标)

位於島上的帕格
位於島上的帕格
Location map (克罗地亚)
{{Location map | Croatia
| alt     = 位於島上的帕格
| lat_deg = 44.44
| lon_deg = 15.05
}}

带默认说明和替代文字的地图

位於島上的帕格
位於島上的帕格
帕格
帕格 (克罗地亚)
{{Location map | Croatia
| width = 200
| float = right
| alt = 位於島上的帕格
| label = 帕格
| position = right
| mark = Green pog.svg <!--绿色标示点-->
| lat_deg = 44 | lat_min = 26 <!-- default: lat_dir = N -->
| lon_deg = 15 | lon_min = 3  <!-- default: lon_dir = E -->
}}

标示和标签位于地图之外

里米尼在意大利的位置(地圖之外)
里米尼在意大利的位置(地圖之外)
里米尼
{{Location map | Croatia
| width    = 200
| float    = right
| caption  =
| alt      = 里米尼在意大利的位置(地圖之外)
| lat_deg  = 44.05
| lon_deg  = 12.57 <!--outside map's left border at 13.1-->
| outside  = 1 <!-- we're aware the point is outside the map, so suppress the warning category -->
| label    = 里米尼
| position = right
}}

带自定义说明和文字背景的地图

Imotski
{{Location map
 |Croatia
 |label=Imotski
 |lat=43.44
 |long=17.21
 |position=right
 |width=300
 |float=right
 |background=#FFFFDD
 |caption=Imotski 在克罗地亚的位置
 }}
Imotski在克罗地亚的位置
Imotski
Imotski
Imotski在克罗地亚的位置

標示和標簽都放大了的地圖

意大利的地圖,標記顯示里米尼的位置
意大利的地圖,標記顯示里米尼的位置
里米尼
里米尼在意大利的位置
{{Location map | Italy
| width      = 200
| float      = right
| caption    = 里米尼在意大利的位置
| alt        = 意大利的地圖,標記顯示里米尼的位置
| label      = 里米尼
| label_size = 150 <!--150% of normal size-->
| position   = bottom
| background = orange
| mark       = Orange_pog.svg
| marksize   = 12 <!--size in pixels-->
| lat_deg    = 44.05
| lon_deg    = 12.57
}}

不带说明的地图

Brčko(波斯尼亚和黑塞哥维那)
{{Location map
 |Bosnia
 |label=Brčko
 |position=left
 |width=150
 |lat=44.87
 |long=18.81
 |float=right
 |caption=
 }}
Brčko在波斯尼亚和黑塞哥维那的位置
Brčko
Brčko

地形图参数

Also demonstrates automatic positioning of label to the left, due to far right position of mark.

Biratnagar Airport is located in southeastern Nepal
Biratnagar Airport is located in southeastern Nepal
Biratnagar
Location of Biratnagar Airport in Nepal
{{Location map | Nepal
| relief = yes
| caption = Location of Biratnagar Airport in Nepal
| alt = Biratnagar Airport is located in southeastern Nepal
| label = Biratnagar
| mark = Airplane silhouette.svg
| marksize = 10
| lat_deg = 26 | lat_min = 28 | lat_sec = 53 | lat_dir = N
| lon_deg = 87 | lon_min = 15 | lon_sec = 50 | lon_dir = E
}}
Biratnagar Airport is located in southeastern Nepal
Biratnagar Airport is located in southeastern Nepal
Biratnagar
Location of Biratnagar Airport in Nepal
{{Location map | Nepal
| relief = 
| caption = Location of Biratnagar Airport in Nepal
| alt = Biratnagar Airport is located in southeastern Nepal
| label = Biratnagar
| mark = Airplane silhouette.svg
| marksize = 10
| lat_deg = 26 | lat_min = 28 | lat_sec = 53 | lat_dir = N
| lon_deg = 87 | lon_min = 15 | lon_sec = 50 | lon_dir = E
}}

置换成其它地图的参数(AlternativeMap)

意大利的地圖,標記顯示羅馬的位置
意大利的地圖,標記顯示羅馬的位置
羅馬
羅馬在意大利的位置
{{Location map | Italy
| AlternativeMap = Italy location map.svg
| width   = 200
| float   = right
| caption = 羅馬在意大利的位置
| alt     = 意大利的地圖,標記顯示羅馬的位置
| label   = 羅馬
| lat_deg = 41.9
| lon_deg = 12.5
}}

在不同地图显示同一坐标

Lockerbie is in southern Scotland.
Lockerbie is in southern Scotland.
Lockerbie
Lockerbie in Scotland, UK
{{Location map | Scotland
| 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
}}
Lockerbie is in southern Scotland.
Lockerbie is in southern Scotland.
Lockerbie
Lockerbie in Scotland, UK
{{Location map | United Kingdom
| 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
}}

西半球

Location map在英国的位置
洛克比
洛克比
蘇格蘭的洛克比
{{Location map many | United Kingdom
| width = 180
| float = right
| caption = 蘇格蘭的洛克比
| label = 洛克比
| position = right
| lat_deg = 55 | lat_min=07 | lat_sec=16 | lat_dir=N
| lon_deg = 3 | lon_min=21 | lon_sec=19 | lon_dir=W
}}

幅员超过180°经度的国家

蘇瓦在斐濟的位置
蘇瓦
蘇瓦
蘇瓦 (斐濟)
{{Location map | Fiji
| width      = 180
| float      = right
| label      = 蘇瓦
| position   = right
| background = yellow
| mark       = Locator_Dot.png
| marksize   = 7
| lat_deg =  18 | lat_min =  8 | lat_sec = 0 | lat_dir = S
| lon_deg = 178 | lon_min = 26 | lon_sec = 0 | lon_dir = E
}}

用户选择多个地图

需使用用户工具显示地图切换按钮才能使本功能生效。

Lockerbie is in southern Scotland.
Lockerbie is in southern Scotland.
Lockerbie
Lockerbie in Scotland, UK
Lockerbie is in southern Scotland.
Lockerbie is in southern Scotland.
Lockerbie
Lockerbie (英国)
{{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
}}

“coordinates”與“lat_deg”“lat”

如果“coordinates”參數與“lat_deg”參數同時使用,只有“coordinates”的值會生效。

Location map在克罗地亚的位置
Location map
“coordinates”參數優先於“lat_deg”(“lat_deg”等參數所示位置位於克羅地亞海岸)
{{Location map | Croatia
| coordinates = {{Coord|42|26|N|14|3|E}}
| lat_deg = 44 | lat_min = 26
| lon_deg = 15 | lon_min = 3
}}

如果“coordinates”參數與“lat”參數同時使用,只有“coordinates”的值會生效。

Location map在克罗地亚的位置
Location map
“coordinates”參數優先於“lat”(“lat”等參數所示位置位於克羅地亞海岸)
{{Location map | Croatia
| coordinates = {{Coord|42|26|N|14|3|E}}
| lat = 44.4333
| long = 15.05
| caption = “coordinates”參數優先於“lat”(“lat”等參數所示位置位於克羅地亞海岸)
}}

全部参数

参数 默认值 描述
{1}    
AlternativeMap= Location map {1}|image [[File: {}]]
background=   background-color: {};
border= #CCCCCC border: {};
caption=    
float=   float: {}; clear: {};
label= {PAGENAME}  
lat= 0  
lat_deg= 0  
lat_dir=    
lat_min= 0  
lat_sec= 0  
long= 0  
lon_deg= 0  
lon_dir=    
lon_min= 0  
lon_sec= 0  
mark= Red pog.svg [[File: {}]]
marksize= 8 [[File: {}px]]
font-size: {}px;
position= right  
width= 240 File: {}px
width: ({}+2)px;

另請參見

无描述。

模板参数[编辑模板数据]

参数描述类型状态
widthwidth

以像素为单位确定贴图的宽度,覆盖任何默认值;不包括px。例如,使用| width=300,而不是| width=300px。

未知可选
default_widthdefault_width

以像素为单位确定地图的默认宽度,供模板使用,例如放置信息框;默认值为240。不包括px。该值将乘以各个地图模板中指定的defaultscale参数(如果存在),以获得垂直地图的适当大小。例如,如果给定| default_width=200,将显示宽度为200×0.57=114像素的泰国地图(如模块:Location map/data/Thailand中所述)。

未知可选
max_widthmax_width

地图的最大大小(以像素为单位)。供模板使用,例如放置信息框。不包括px。

未知可选
floatfloat

指定地图在页面上的位置;有效值包括left, right, center 和none。默认值是right

未知可选
borderborder

指定1px地图边框的颜色;默认值为浅灰色(请参见网页颜色)。如果设置为“无”,则不会生成边框。这个参数很少使用。

未知可选
captioncaption

地图下方显示的标题文本;指定标题将使地图显示一个框架。如果定义了| caption=但未指定值,则地图将不加边框,也不会显示任何标题。如果未定义| caption=,则不会对地图进行框显,并生成默认标题。默认标题是根据地图定义模板中的| label=参数(如果|label=未定义,则为当前页面名称)和|name=参数创建的。当以##分隔时,可以显示多个标题(即两个)。

未知可选
altalt

Alt text for map; used by screen readers. See WP:ALT.

未知可选
reliefrelief

任何非空值(1、yes等)都会导致模板将地图定义模板中指定的地图显示为image1,这通常是一张地形图;请参见[[模板:Location map+/relief]]上的示例。

未知可选