模板: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}}

此处坐标使用小数度数表示。

以下可选参数跟在经度后,以下划线("_")分割:

以下可选参数使用竖线("|")分割:

  • 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编辑 | 历史
编者可以在本模板的沙盒创建 | 镜像和测试样例创建页面进行实验。
请将模板自身所属的分类添加在文档中。本模板的子页面