模板:Coord

本页使用了标题或全文手工转换,现处于台湾繁体模式
模板頁面
文檔圖示 模板文件[檢視] [編輯] [查看歷史] [清除快取]

模板連結:{{coord}}模板根基於地理坐標及其他參數,生成一個前往地圖資源清單的連結,並提供一個標準化的坐標表示法。

坐標用法速查
要在條目頂端加入57°18′22″N 4°27′32″W / 57.30611°N 4.45889°W / 57.30611; -4.45889,可以這樣使用 模板連結:{{Coord}}:
{{Coord|57|18|22|N|4|27|32|W|display=title}}

此處的經緯坐標使用角度、秒表示法。

"display=title" 表示將坐標顯示在條目標題旁。

要在條目頂端加入 44°06′43″N 87°54′47″W / 44.112°N 87.913°W / 44.112; -87.913,可以使用以下兩者之一:
{{Coord|44.112|N|87.913|W|display=title}}

{{Coord|44.112|-87.913|display=title}}

此處坐標使用小數度數表示。

以下可選參數跟在經度後,以下劃線("_")分割:
  • dim: dim:N(可視半徑,公尺)
  • region: region:R(區域號,使用ISO 3166-1二位字碼或ISO 3166-2
  • type: type:T (類型,如landmarkcity(30,000)

以下可選參數使用豎線("|")分割:

  • display
    |display=inline(默認)只和文字顯示在一起
    |display=title 只在標題旁顯示
    |display=inline,title 兩處都顯示
  • name
    name=X 可以制定地圖上坐標點的名稱(默認為PAGENAME

例如:{{Coord|44.117|-87.913|dim:30_region:US-WI_type:event

|display=inline,title|name=事故地点}}

|display=title|display=inline,title 用於條目所表述的對象,只應在條目中出現一次。

若使用其他的角度單位,請參看以下轉換表:

相同角度的轉換表
角度單位
角度 30° 45° 60° 90° 180° 270° 360°
弧度
梯度

本模板的輸出數據以下列形式提供:

  • 度/分/秒(「DMS」,精確度是度、或度/分、或度/分/秒,基於輸入值)。一些從十進位(小數的)度到度分秒的換算需要修正(參見英文討論)。
  • 小數(精確度由小數位數確定,基於輸入值)。

用法

{{coord|''latitude''|''longitude''|''坐标参数''|''模板参数''}}
{{coord|''dd''|''N/S''|''dd''|''E/W''|''坐标参数''|''模板参数''}}
{{coord|''dd''|''mm''|''N/S''|''dd''|''mm''|''E/W''|''坐标参数''|''模板参数''}}
{{coord|''dd''|''mm''|''ss''|''N/S''|''dd''|''mm''|''ss''|''E/W''|''坐标参数''|''模板参数''}}


有兩類參數,都是可選的:

  • 坐標參數:以地圖伺服器識別,以參數:值的格式給出,並且藉由下劃線字符「_」互相隔開。常見的坐標參數包括typeregion、和scale。參見坐標參數查看全面的列表。
  • 模板參數:為模板自身所使用,以參數=值的格式給出,並且由管道符「|」互相隔開。支持的模板參數有displaynameformat
    • display可以為下列之一:
      • display=inline — 內嵌(inline)顯示坐標(預設值)
      • display=title — 顯示坐標在條目標題旁邊(取代模板連結:{{coor title dms}}模板家族),捷徑為display=t
      • display=inline,title — 同時內嵌顯示和在標題處顯示坐標(取代模板連結:{{coor at dms}}模板家族)
        注意:使用title屬性表明坐標適用於該條目,而不只是適用於條目中提及的某一個地點(可能提及了許多地點)——因此該屬性只能在後一種情形下才應當省略。display=title,inline也是有效的。捷徑為display=it
    • format可以用來強制顯示dec或dms坐標給所有讀者。
    • name可以用來注釋內嵌坐標,用於在地圖服務或其他外部用途中的顯示。它不應用到條目標題旁,或顯示於一個信息框內部的那些坐標,由於在那些情況下條目標題就是隱含的名稱。
    • notes可以用來指定緊接在坐標後的文字。主要用於給標題旁的坐標添加腳註。
    • qid可以用來指定顯示哪個數據項的坐標。主要用於使用維基數據的信息框。

坐標參數

跟隨地理坐標之後,更多參數可能選擇性地提供,它們由下劃線分隔。這會幫助找到適當的地圖資源,當Wikimaps變得完全泛函化(become fully functional)時這一點也會變得更加重要。

顯示

預設情況下坐標以那些指定的格式顯示。

若要總是顯示坐標為度分秒值,添加以下代碼到你的common.css

.geo-default { display: inline } .geo-nondefault { display: inline }
.geo-dec { display: none } .geo-dms { display: inline }

若要總是顯示坐標為十進位值,添加以下代碼到你的monobook.css:

.geo-default { display: inline } .geo-nondefault { display: inline }
.geo-dec { display: inline } .geo-dms { display: none }

若要同時以兩種格式顯示坐標,添加以下代碼到你的monobook.css:

.geo-default { display: inline } .geo-nondefault { display: inline }
.geo-dec { display: inline } .geo-dms { display: inline }
.geo-multi-punct { display: inline }

如果CSS遭到禁用,或者你有一個被緩存的舊版MediaWiki:Common.css,你將同時看到兩種格式。

類名

類名geolatitudelongitude用來生成微格式,並且一定不要更改。

模板數據

Coord模板資料

用於提供一個地點的經緯度坐標,提供該地點的地圖連結。This template does not work well with the Visual Editor, consider using {{coordDec}} for signed decimal degrees, {{coordDMS}} when degrees minutes and seconds are specified {{coordDM}} when only degrees and minutes are specified. To use this template you will need to use positional parameter following one of these schemes: {{coord | D | M | S | NS | D | M | S | EW | geo | opts}}, {{coord | D | M | NS | D | M | EW | geo | opts}}, {{coord | D| NS | D| EW | geo | opts}} {{coord | sD | sD | geo | opts}} where D is degrees, M is minutes, S seconds, sD signed decimal degrees, NS is N or S, EW is E or W, opts are named parameter and geo are the coordinate parameters described on the main doc page.

模板參數[編輯模板資料]

此模板以參數行內格式為優先。

參數描述類型狀態
11

Either degrees latitude or a signed decimal degrees latitude

數值建議
22

Either: minutes latitude, signed decimal degrees longitude or 'N' or 'S'.

字串建議
33

Either: second latitude, degrees longitude, 'N' or 'S' or GeoHack parameters

字串非必填
44

Either: degrees longitude, 'N', 'S', 'E' or 'W' or GeoHack parameters

字串非必填
55

Either: degrees longitude, minutes longitude or GeoHack parameters

字串非必填
66

Either: minutes longitude, 'E' or 'W' or GeoHack parameters

字串非必填
77

Either second longitude, or GeoHack parameters

字串非必填
88

'E' or 'W'.

字串非必填
99

GeoHack parameters. Example: dim:30_region:US-WI_type:event

字串非必填
維基數據項目qid

從WikiData項目而不是從該模板的參數中檢索坐標

範例
Q513
非必填
顯示方式display

顯示的位。可填寫:'inline',即在條目中;'title',即在條目頂端;'inline,title',兩者兼有

預設
inline
建議
名稱name

要放置在地圖上的標籤(默認為頁面名)

字串非必填
注釋notes

在坐標後面顯示的文本

字串非必填
格式format

坐標格式,'dec'或'dms'

非必填
上述文檔內容嵌入自Template:Coord/doc編輯 | 歷史
編者可以在本模板的沙盒創建 | 鏡像和測試樣例創建頁面進行實驗。
請將模板自身所屬的分類添加在文檔中。本模板的子頁面