模板:Location map/sandbox
| File:Sandbox.svg | 這是Template:Location map(差異)的沙盒。 參見本模板的測試樣例。 |
| 警告 | 此模板沙盒被引用於許多頁面。 為了避免造成大規模的影響,所有對此模板沙盒的編輯應先於沙盒、測試樣例或您的沙盒上測試。 測試後無誤的版本可以一次性地加入此模板沙盒中,但是修改前請務必於討論頁發起討論。 模板引用數量會自動更新。 |
| File:Lua-Logo.svg | 此模板使用Lua語言: |
本模板生成一個由地圖和位置標記組成的複合圖像,還可以添加標籤和說明文字。
用法[編輯]
本模板不直接讀取地圖圖像文件,而是通過輔助地圖模板定義。例如,如果提供給本模板的第一個匿名參數是Japan,那麼本模板將使用Module:Location map/data/Japan中的數據(如果存在),這些數據包含生成複合圖像所需的信息。
注意事項[編輯]
|caption=參數填寫任何值會使得地圖顯示邊框(即縮略圖樣式);如果|caption=留空則顯示默認標題,但無邊框;如果不使用|caption=參數,則不顯示標題且無邊框。- 坐標不會被檢查。如果指定的坐標超出了地圖圖像的區域,位置標記將不會顯示在圖像內部,但可能會顯示在頁面的其他地方。
- 設置地圖大小時不要使用
px,如使用|width=200,而不是|width=200px。 - 本模板僅支持顯示單個位置標記,要創建帶有多個位置標記的地圖,請使用{{Location map+}}或{{Location map many}}。
空白模板[編輯]
| 十進制度數 | 度、分、秒 | 使用{{Coord}} (通常用於信息框) |
由維基數據提供坐標 |
|---|---|---|---|
{{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 =
}}
|
參數說明[編輯]
<templatedata>
{
"params": {
"1": {
"label": "地圖名稱",
"description": "要使用的地圖名稱。可以用 「#」分隔的形式提供多個地圖。 ",
"type": "string",
"required": true
},
"width": {
"description": "地圖的寬度,以像素(px)為單位;不要包含 「px」。例如,填寫 「width=300」,而不是 「width=300px」。 ",
"label": "地圖寬度 ",
"type": "number"
},
"default_width": {
"description": "地圖的默認寬度,以像素(px)為單位,不要包含 「px」。供模板(例如地理類信息框)使用;默認值為240。該值將乘以各個地圖模板中指定的defaultscale參數(如果存在),以獲得垂直地圖的適當大小。例如,如果給定default_width=200,將顯示寬度為200×0.57=114像素的泰國地圖(如模塊:Location map/data/Thailand中所述)。",
"label": "默認寬度",
"type": "number"
},
"float": {
"description": "指定地圖在頁面上的位置;有效值包括「left」、「right」、「center」和「none」。默認值是「right」。",
"label": "位置",
"type": "string",
"suggestedvalues": [
"left",
"right",
"center",
"none"
],
"default": "right"
},
"border": {
"description": "指定使用caption參數時地圖邊框的顏色。如果設置為 「none」,則不會生成邊框。 ",
"label": "邊框樣式",
"type": "string"
},
"caption": {
"description": "顯示在地圖下方的說明文字;指定說明文字後地圖將顯示邊框。如果定義了caption但未賦值,則地圖不會顯示邊框,也不會顯示說明文字。如果未定義caption,則地圖將不會顯示邊框,並生成默認說明文字。",
"label": "地圖說明",
"type": "string"
},
"alt": {
"description": "地圖的替代文字;供屏幕閱讀器使用。 ",
"label": "替代文字",
"type": "string"
},
"relief": {
"description": "任何非空值(1、yes等)都會導致模板將地圖定義模板中指定的地圖顯示為image1,這通常是一張地形圖;請參見模板:Location map+/relief上的示例。",
"label": "顯示備選地圖",
"type": "string"
},
"AlternativeMap": {
"label": "自定義備選地圖",
"description": "允許使用自定義的地圖圖像;圖像邊緣的坐標必須與所使用的定位圖模板相同。 ",
"type": "string"
},
"overlay_image": {
"label": "疊加圖像",
"description": "允許在地圖上疊加疊加層;該參數很少使用。",
"type": "string"
},
"label": {
"label": "標籤文字",
"description": "顯示在位置標記旁邊的標籤文字;可以添加內部連結。 ",
"type": "string"
},
"label_size": {
"label": "標籤大小",
"description": "標籤文字的字體大小,以相當於正常大小的百分比表示;請勿包含「%」。 ",
"type": "number"
},
"label_width": {
"label": "標籤寬度",
"description": "標籤的寬度,以em為單位;請勿包含「em」。",
"type": "number"
},
"position": {
"label": "標籤位置",
"description": "標籤相對於位置標記的位置;有效值為 「left」、「right」、「top」、「bottom 」和 「none」。默認為 「left 」或 「right」(取決於位置標記在地圖中的位置)。當 設置「position=none 」時,不會顯示標籤,但標籤文字可被用於默認地圖說明。",
"type": "string",
"suggestedvalues": [
"left",
"right",
"top",
"bottom ",
"none"
]
},
"background": {
"label": "標籤背景顏色",
"description": "標籤的背景顏色。 ",
"type": "string"
},
"mark": {
"label": "位置標記圖像",
"description": "位置標記顯示的圖像文件名。 ",
"type": "wiki-file-name"
},
"marksize": {
"label": "位置標記大小",
"description": "位置標記的大小,以像素(px)為單位;不包括「px」。 ",
"type": "number"
},
"link": {
"label": "位置標記連結",
"description": "指定一個內部連結,讀者點擊位置標記時跳轉。",
"type": "wiki-page-name"
},
"coordinates": {
"label": "坐標",
"description": "在地圖上顯示的位置標記的坐標,通常使用坐標:缺少緯度
無效參數傳遞至{{#coordinates:}}函數模板。"
},
"lat_deg": {
"type": "number"
},
"lat_min": {
"type": "number"
},
"lat_sec": {
"type": "number"
},
"lat_dir": {
"type": "string",
"suggestedvalues": [
"N",
"S"
]
},
"lon_deg": {
"type": "number"
},
"lon_min": {
"type": "number"
},
"lon_sec": {
"type": "number"
},
"lon_dir": {
"type": "string",
"suggestedvalues": [
"E",
"W"
]
}
},
"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"
],
"description": "該模板在地圖上放置位置標記。",
"format": "block"
}
</templatedata>
可用地圖[編輯]
同時可以參閱Category:地理位置圖模板(現時還很不完整,但對於一些子類很有用)。
注意:當調用的地圖同時存在於Module:Location map/data/……、{{Template:Location map location ……}}中時,優先顯示Module:Location map/data/……中的地圖。
建立新地圖步驟[編輯]
- 找到一幅合適的使用正距圓筒圖法的空白地圖
- 以「Module:Location map/data/location」的名稱建立模板(可從其他地圖模板複製過來,並輸入相關數據)
參見:創建一個新地圖模版
範例[編輯]
帶默認說明的地圖(度/分)[編輯]
{{Location map | Croatia
| alt = 位於島上的帕格
| lat_deg = 44 | lat_min = 26
| lon_deg = 15 | lon_min = 3
}}
帶默認說明的地圖(十進制坐標)[編輯]
{{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在克羅埃西亞的位置 |
標示和標簽都放大了的地圖[編輯]
{{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=
}}
|
地形圖參數[編輯]
Also demonstrates automatic positioning of label to the left, due to far right position of mark.
{{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
}}
{{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
}}
在不同地圖顯示同一坐標[編輯]
{{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
}}
{{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 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
}}
用戶選擇多個地圖[編輯]
{{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 | 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 | Croatia
| coordinates = {{Coord|42|26|N|14|3|E}}
| lat = 44.4333
| long = 15.05
| caption = “coordinates”參數優先於“lat”(“lat”等參數所示位置位於克羅地亞海岸)
}}
另請參見[編輯]
- Template:Location map many – 放置多個標示和標籤
- Template:Location map+ – 放置標示和標籤的長列表
- Template:Location map skew – 沿著匯合的經線做映射(非正距圓筒圖法)
- commons:Category:Map pointers