跳至內容

英文维基 | 中文维基 | 日文维基 | 草榴社区

模組:Infobox mapframe/doc

本頁使用了標題或全文手工轉換
維基百科,自由的百科全書

此頁面為 Module:Infobox mapframe 的說明文件

用法

[編輯]

該模組可自動生成適合資訊框的mapframe,編者只需輸入少量資訊即可。

通用用法

[編輯]

只需使用模板{{Infobox mapframe}},按照其文檔進行操作即可。該模組也可以匯入到另一個Lua模組中。

資訊框中的自動地圖

[編輯]
範例編輯: Template:Infobox prisonTemplate:Infobox prison/doc

編輯資訊框模板(或其沙盒)。

在資訊框中添加類似以下範例的行。將數字(4,或9799)替換為適當的數字,具體數字取決於已有多少其他圖像或data參數。

如果放在資訊框頂部附近 如果放置在資訊框底部或底部附近
| image4     = {{#invoke:Infobox mapframe|auto}}
| caption4   = {{#invoke:Infobox mapframe|autocaption}}
| header97   = {{#if:{{{mapframe|}}}|地图}}
| data98     = {{#invoke:Infobox mapframe|auto}}
| data99     = {{#invoke:Infobox mapframe|autocaption}}

如果模板中使用了{{#invoke:Check for unknown parameters}},請向其添加以下參數:

|mapframe|mapframe-area_km2|mapframe-area_mi2|mapframe-caption|mapframe-coord|mapframe-coordinates|mapframe-custom|mapframe-frame-coord|mapframe-frame-coordinates|mapframe-frame-height|mapframe-frame-width|mapframe-geomask|mapframe-geomask-fill|mapframe-geomask-fill-opacity|mapframe-geomask-stroke-color|mapframe-geomask-stroke-colour|mapframe-geomask-stroke-width|mapframe-height|mapframe-id|mapframe-length_km|mapframe-length_mi|mapframe-marker|mapframe-marker-color|mapframe-marker-colour|mapframe-point|mapframe-shape|mapframe-shape-fill|mapframe-shape-fill-opacity|mapframe-stroke-color|mapframe-stroke-colour|mapframe-stroke-width|mapframe-switcher|mapframe-width|mapframe-wikidata|mapframe-zoom

完成此操作後,模板即可使用上述參數。 這些參數也可以在前述#invoke調用中指定預設值,例如{{#invoke:Infobox mapframe|auto|mapframe-marker=library}}表示預設使用「library」圖標,除非向模板傳遞不同的值。

  • 預設情況下地圖是關閉的,這意味着除非在模板調用時出現|mapframe=yes,否則地圖不會顯示。要預設打開地圖,可在上述#invoke調用中添加|onByDefault=yes——這意味着除非模板調用中包含|mapframe=no,否則將顯示地圖。onByDefault也可以設定為一個條件,例如:|onByDefault={{#if:{{pushpin_map|}}|no|yes}}
  • 更新模板文件中的參數說明。可以使用{{Infobox mapframe/doc/parameters}}。通過以|參數名=值的形式指定預設值(如果在#invoke調用中使用了預設值)。以下是預設輸出:
延伸內容
  • 基本參數:
    • mapframe — 指定yesno以顯示或隱藏地圖,覆蓋預設值。預設:no
    • mapframe-caption — 地圖說明。預設: 空白(或如果設定了|mapframe-geomask=,則:「在<遮罩標籤>的位置」)
    • mapframe-custom — 使用自訂地圖代替自動地圖框架。請使用{{maplink}}模板(或其他可生成地圖框架的模板)或圖像檔案名稱稱。如果使用,後續的mapframe參數將被忽略。預設:未指定
    • mapframe-ididqid — 要使用的維基數據項QID。預設:當前頁面對應數據項
    • mapframe-coordinatesmapframe-coordcoordinatescoord — 指定的坐標,而不是維基數據上的坐標。使用{{Coord}}模板,例如:|coord={{Coord|12.34|N|56.78}}預設:來自維基數據的坐標
    • mapframe-wikidata — 當設定了|coord=時,設為yes以顯示維基數據中的面/線特徵(如果有)。預設: 未指定
  • 自訂顯示哪些特徵:
    • mapframe-point — 設為none時關閉點標記的顯示。設為on時強制顯示點標記。預設: 未指定
    • mapframe-line — 設為none時關閉線特徵的顯示。預設: 未指定
    • mapframe-shape — 設為none時關閉面特徵的顯示。設為inverse時使用反轉形狀(geomask)代替常規形狀。預設: 未指定
    • mapframe-geomask — 用作遮罩的維基數據項(遮罩邊界外的區域變暗)。可以是特定的維基數據項(QID),或數據項的屬性(例如,P17表示國家 (P17)P131表示所在行政領土實體 (P131))。預設: 未指定
    • mapframe-switcher — 設定為autogeomaskszooms,以啟用切換多個地圖框架的功能(以Template:Switcher的風格)。預設: 未指定
      • auto — 以維基數據項的位置 (P276)所在行政領土實體 (P131)聲稱為遮罩進行切換,遞歸搜尋。例如,數據項的城市、該城市的州以及該州的國家。
      • geomasks — 在mapframe-geomask參數中的維基數據項(QID)列表(以逗號分隔)指定的遮罩之間切換。
      • zooms — 在「zoomed in」/「zoomed midway」/「zoomed out」之間切換,其中「zoomed in」為預設縮放(最小值為3),「zoomed out」為1,而「zoomed midway」為平均值。
  • 其他可選參數:
    • mapframe-frame-widthmapframe-width — 框架寬度。預設:270
    • mapframe-frame-heightmapframe-height — 框架高度。預設:200
    • mapframe-shape-fill — 面特徵的填充顏色。預設:#606060
    • mapframe-shape-fill-opacity — 面特徵填充的不透明度,數值介於0和1之間。預設:0.5
    • mapframe-stroke-colormapframe-stroke-colour — 線特徵、面特徵輪廓的顏色。預設:#ff0000
    • mapframe-stroke-width — 線特徵、面特徵輪廓的粗細。預設:5
    • mapframe-marker — 用於坐標點標記的符號;具體選項參見mw:Help:Extension:Kartographer/Icons預設: 未指定(即blank)
      • 也可以設定為blank以覆蓋預設標記符號。
    • mapframe-marker-colormapframe-marker-colour — 點標記的背景顏色。預設:#5E74F3
    • mapframe-geomask-stroke-colormapframe-geomask-stroke-colour — 遮罩輪廓的顏色。預設:#555555
    • mapframe-geomask-stroke-width — 遮罩輪廓的粗細。預設:2
    • mapframe-geomask-fill — 遮罩外部區域的填充顏色。預設:#606060
    • mapframe-geomask-fill-opacity — 遮罩外部區域填充的不透明度,數值介於0和1之間。預設:0.5
    • mapframe-zoom — 設定縮放級別,從「1」(全球地圖)到 「18」(最大級別),用於無法根據對象長度或面積自動確定縮放級別的情況。預設:10
    • mapframe-length_kmmapframe-length_mimapframe-area_km2mapframe-area_mi2 — 通過輸入對象的長度(以公里或英里為單位)或面積(以平方公里或平方英里為單位)來確定縮放級別。預設:未指定
    • mapframe-frame-coordinatesmapframe-frame-coord — 地圖初始位置的備用坐標,使用使用{{coord}}模板。預設:衍生自專案坐標
  • 模板資料部分可插入下面的範例來更新:
延伸內容

沒有描述。

模板參數

參數描述類型狀態
Show mapframe mapmapframe

Specify yes or no to show or hide the map, overriding the default

預設
no
範例
yes
字串建議
Mapframe captionmapframe-caption

Caption for the map. If mapframe-geomask is set, then the default is "Location in <<geomask's label>>"

字串非必填
Custom mapframemapframe-custom

Use a custom map instead of the automatic mapframe. Specify either a {{maplink}} template, or another template that generates a mapframe map, or an image name. If used, other mapframe parameters will be ignored.

模板非必填
Mapframe Wikidata itemmapframe-id id qid

Id (Q-number) of Wikidata item to use.

預設
(item for current page)
字串非必填
Mapframe coordinates mapframe-coordinates mapframe-coord coordinates coord

Coordinates to use, instead of any on Wikidata. Use the {{Coord}} template.

預設
(coordinates from Wikidata)
範例
{{Coord|12.34|N|56.78|E}}
模板非必填
Mapframe shapes from Wikidatamapframe-wikidata

et to yes to show shape/line features from the wikidata item, if any, when coordinates are specified by parameter

範例
yes
字串非必填
Mapframe point featuremapframe-point

Override display of mapframe point feature. Turn off display of point feature by setting to "none". Force point marker to be displayed by setting to "on"

字串非必填
Mapframe shape featuremapframe-shape

Override display of mapframe shape feature. Turn off by setting to "none". Use an inverse shape (geomask) instead of a regular shape by setting to "inverse"

字串非必填
Mapframe widthmapframe-frame-width mapframe-width

Frame width in pixels

預設
270
數值非必填
Mapframe heightmapframe-frame-height mapframe-height

Frame height in pixels

預設
200
數值非必填
Mapframe shape fillmapframe-shape-fill

Color used to fill shape features

預設
#606060
字串非必填
Mapframe shape fill opacitymapframe-shape-fill-opacity

Opacity level of shape fill, a number between 0 and 1

預設
0.5
數值非必填
Mapframe stroke colormapframe-stroke-color mapframe-stroke-colour

Color of line features, and outlines of shape features

預設
#ff0000
字串非必填
Mapframe stroke widthmapframe-stroke-width

Width of line features, and outlines of shape features

預設
5
數值非必填
Mapframe markermapframe-marker

Marker symbol to use for coordinates; see [[mw:Help:Extension:Kartographer/Icons]] for options

範例
museum
字串非必填
Mapframe marker colormapframe-marker-color mapframe-marker-colour

Background color for the marker

預設
#5E74F3
字串非必填
Mapframe geomaskmapframe-geomask

Wikidata item to use as a geomask (everything outside the boundary is shaded darker). Can either be a specific Wikidata item (Q-number), or a property that specifies the item to use (e.g. P17 for country, or P131 for located in the administrative territorial entity)

範例
Q100
頁面名稱非必填
Mapframe geomask stroke colormapframe-geomask-stroke-color mapframe-geomask-stroke-colour

Color of outline of geomask shape

預設
#555555
字串非必填
Mapframe geomask stroke widthmapframe-geomask-stroke-width

Width of outline of geomask shape

預設
2
數值非必填
Mapframe geomask fillmapframe-geomask-fill

Color used to fill outside geomask features

預設
#606060
字串非必填
Mapframe geomask fill opacitymapframe-geomask-fill-opacity

Opacity level of fill outside geomask features, a number between 0 and 1

預設
0.5
數值非必填
Mapframe zoommapframe-zoom

Set the zoom level, from "1" to "18", to used if the zoom level cannot be determined automatically from object length or area

預設
10
範例
12
數值非必填
Mapframe length (km)mapframe-length_km

Object length in kilometres, for automatically determining zoom level. ONLY use ONE of the available parameters for length or area

數值非必填
Mapframe length (mi)mapframe-length_mi

Object length in miles, for automatically determining zoom level. ONLY use ONE of the available parameters for length or area

數值非必填
Mapframe area (km^2)mapframe-area_km2

Object arean square kilometres, for automatically determining zoom level. ONLY use ONE of the available parameters for length or area

數值非必填
Mapframe area (mi^2)mapframe-area_mi2

Object area in square miles, for automatically determining zoom level. ONLY use ONE of the available parameters for length or area

數值非必填
Mapframe frame coordinatesmapframe-frame-coordinates mapframe-frame-coord

Alternate latitude and longitude coordinates for initial placement of map, using {{coord}}

範例
{{Coord|12.35|N|56.71|E}}
模板非必填
Mapframe switchermapframe-switcher

Set to "auto" or "geomasks" or "zooms" to enable Template:Switcher-style switching between multiple mapframes. IF SET TO auto – switch geomasks found in location (P276) and located in the administrative territorial entity (P131) statements on the page's Wikidata item, searching recursively. E.g. an item's city, that city's state, and that state's country. IF SET TO geomasks – switch between the geomasks specified as a comma-separated list of Wikidata items (Q-numbers) in the mapframe-geomask parameter. IF SET TO zooms – switch between "zoomed in"/"zoomed midway"/"zoomed out", where "zoomed in" is the default zoom (with a minimum of 3), "zoomed out" is 1, and "zoomed midway" is the average.

字串非必填

參見

[編輯]