Templat:Maplink/doc: Perbedaan antara revisi
Konten dihapus Konten ditambahkan
Peringatan templat tidak dapat digunakan |
melanjutkan menerjemahkan Tag: Suntingan visualeditor-wikitext |
||
(4 revisi perantara oleh 3 pengguna tidak ditampilkan) | |||
Baris 1:
{{Documentation subpage}}
<includeonly>{{template shortcut|Mapframe}}</includeonly>
{{Lua|Module:Mapframe}}
Baris 7 ⟶ 6:
|image=[[File:Openstreetmap logo.svg|40x40px]]
|text=This template uses the [[OpenStreetMap]] tag:
*'''''[
}}
<!-- PLEASE ADD CATEGORIES WHERE INDICATED AT THE BOTTOM OF THIS PAGE -->
Templat ini menambahkan sebuah pranala, atau sebuah bingkai, yang akan menampilkan data peta. Informasi yang diperlukan templat ini dapat berupa
* data
* fitur ''line''/''polygon''
*
* data GeoJSON mentah, contohnya (yang disarankan) dari hasil transklusi dari halaman lain
Catatan:
* Jika Anda memiliki peta yang sangat besar atau memerlukan waktu lama untuk diproses, Anda sebaiknya langsung menggunakan tag <code>mapframe</code> ketimbang menggunakan templat ini, contohnya pada [[en:Special:Diff/970846012]]. Alasannya karena penggunaan templat ini untuk memanggil tag akan membuat proses menampilkan (''rendering'') peta dianggap sebagai waktu Lua, yang mungkin menghasilkan galat ''time exceeded''.
* Berkas GeoJSON saat ini tidak dapat langsung diunggah. Solusinya, buatlah halaman di [[c:|Wikipedia Commons]] pada ruang nama <code>Data:</code> dan diakhiri <code>.map</code> – sebagai contoh '''Data:Contoh.map'''. Lihat [[mw:Help:Map Data]] untuk informasi lebih lanjut.
* Untuk membuat fitur-fitur OpenStreetMap (OSM) tersedia, tambahkan identifier Wikidata ke relasi OSM relation (dan tunggu sekitar 1-2 hari). Lihat bantuan ekstensi ''Kartographer'' mengenai [[mw:Help:Extension:Kartographer#External_data|data eksternal]] dan [[mw:Help:Extension:Kartographer/OSM|OSM]] untuk informasi lebih lanjut.
== Tujuan ==
Templat ini ditujukan untuk fitur-fitur ''points'' maupun ''linear'' atau ''polygon'', seperti (namun tidak terbatas pada):
* Jalan
* Sungai
* Subway atau jalur kereta
* Lintasan kapal
* Rute pesawat
* Jejak pendakian
* Habitat hewan
* Negara dan bagian-bagian didalamnya
* dan lain lain...
Templat ini juga dapat digunakan untuk menampilkan fitur titik, yakni koordinat, pada suatu peta.
== Penggunaan ==
Penggunaan yang sederhana
*{{maplink|from=ecos.fws.gov/Endangered habitat 58938/Plethodon neomexicanus.map|text=Halaman berisi data}} dari Commons {{small|1=(sebagai contoh [[c:Data:ecos.fws.gov/Endangered habitat 58938/Plethodon neomexicanus.map|Data:ecos.fws.gov/Endangered habitat 58938/Plethodon neomexicanus.map]])}}:
*:<code><nowiki>{{maplink|from=}}</nowiki></code> (sertakan halaman data .map di parameter from=, tanpa ''prefix'' ruang nama Data)
*{{maplink|raw={{en:Wikipedia:Map data/Main Roads Western Australia/Forrest Highway}}|text=data GeoJSON mentah}} {{small|1=(contoh: <nowiki>{{</nowiki>[[en:Wikipedia:Map data/Main Roads Western Australia/Forrest Highway]]<nowiki>}}</nowiki>)}}:
*:<code><nowiki>{{maplink|raw=}}</nowiki></code> (sertakan data GeoJSON dari transklusi halaman lain)
*{{maplink|type=line|id=Q1094308|text=Line of a border or a linear feature}} from OSM:
*:<code><nowiki>{{maplink|type=line|id=}}</nowiki></code> (Wikidata id only required if another article's Wikidata page is to be used)
*{{maplink|type=shape|id=Q1094308|text=Shape}} from OSM:
*:<code><nowiki>{{maplink|type=shape|id=}}</nowiki></code> (Wikidata id only required if another article's Wikidata page is to be used)
*{{maplink|type=shape-inverse|id=Q1094308|text=Inverted shape}} from OSM:
*:<code><nowiki>{{maplink|type=shape-inverse|id=}}</nowiki></code> (Wikidata id only required if another article's Wikidata page is to be used)
*{{maplink|type=point|id=Q1094308|text=Point feature}} (coordinates):
*:...from Wikidata:<br/><code><nowiki>{{maplink|type=point|id=}}</nowiki></code> (Wikidata id only required if another article's Wikidata page is to be used)
*:...from specified coordinates:<br/><code><nowiki>{{maplink|type=point|coord=}}</nowiki></code> (specify coordinates using {{tl|Coord}} template)
*{{maplink|
*:...from Wikidata:<br/><code><nowiki>{{maplink|type=circle|radius=|id=}}</nowiki></code> (Wikidata id only required if another article's Wikidata page is to be used)
*:...from specified coordinates:<br/><code><nowiki>{{maplink|type=circle|radius=|coord=}}</nowiki></code> (specify coordinates using {{tl|Coord}} template)
*To show in a frame, add the parameter {{para|frame|yes}}.<br />{{maplink|frame=yes|frame-align=left|type=line|id=Q1094308|text=Mapframe example}}
{{-}}
*Additional parameters are available to customise the displayed map, such as {{para|plain|yes}} to remove the outer frame.<br />{{maplink|frame=yes|frame-align=left|plain=yes|type=line|id=Q1094308|frame-width=200|frame-height=250|frame-long=19.1009|frame-lat=47.5001|zoom=9}}
{{-}}
*Overlays can also be displayed on top of the map.<br />{{maplink|frame=yes|frame-align=left|frame-width=400|frame-height=300|type=point|id=Q8688|marker=airport|zoom=12
|text=San Francisco International Airport
|overlay={{Graph:Street map with marks|width=110|height=90|lat=37.8|lon=-121.8|zoom=6|{ "lat": 37.618, "lon": -122.375 }| minimap=false}}
}}
{{-}}
<pre>
{{maplink
Baris 66 ⟶ 81:
</pre>
<pre>
{{maplink
Baris 77 ⟶ 92:
</pre>
<pre>
{{maplink
Baris 93 ⟶ 108:
</pre>
<pre>
{{maplink
Baris 109 ⟶ 124:
</pre>
Parameter set – circles
<pre>
{{maplink
|display=
|type=circle
|radius= <!-- in metres, alternative parameters available for other units -->
|id=
|title=
|description=
|coord=
|marker=
|zoom=
|text=
|icon=
}}
</pre>
== Parameter ==
=== Untuk tampilan umum===
;display
:How the template is displayed. Valid values are:
Baris 122 ⟶ 155:
:Set to "no" to turn off the icon that appears next to the link
;zoom
:Zoom level, from <code>1</code> to <code>19</code> (larger numbers zoom in further); default is automatically determined by the map
Mapframe parameters (only work with inline display)
;frame
Baris 134 ⟶ 167:
:;frame-height
::Height of the map frame, default is <code>200</code>
:;frame-coordinates
::''(or '''frame-coord''')''
::Optional - alternate coordinates for initial placement of map. Use {{tl|Coord}} template to specify coordinates {{small|1=(e.g. {{para|frame-coordinates|2=<nowiki>{{Coord|12.34|S|56.78|W}}</nowiki>}})}}. If not set, coordinates will be retrieved from Wikidata.
:;frame-latitude
::''(or '''frame-lat''')''
::''(ignored if ''{{para|frame-coordinates}}'' or ''{{para|frame-coord}}'' is set)''
::Optional - alternate latitude coordinate for initial placement of map.
:;frame-longitude
::''(or '''frame-long''')''
::''(ignored if ''{{para|frame-coordinates}}'' or ''{{para|frame-coord}}'' is set)''
::Optional - alternate longitude coordinate for initial placement of map.
:{{a note}} If frame latitude and longitude are not set by parameters, then frame coordinates can be determined automatically, either:
:*Based on the line and shape objects (if any have been specified), or
:*From the point feature specified in {{para|[[#coord|coord]]}} (if set), or
:*Retrieved from Wikidata (if available – for either the item specified in {{para|id}} parameter, or for the page the template is placed on)
:;overlay
::An image, or another map, to be displayed on top the map. E.g.
:::{{para|overlay|<nowiki>[[File:Example.svg|140x140px]]</nowiki>}} or
:::{{para|overlay|<nowiki>{{maplink|frame=yes|plain=yes|frame-width=100|frame-height=100|type=shape|id=Q100|frame-align=center}}</nowiki>}} or
:::{{para|overlay|<nowiki>{{Graph:Street map with marks|width=100|height=100|lat=37.8|lon=-122.4|zoom=6|{ "lat": 37.8, "lon": -122.4 }|minimap=false}}</nowiki>}}
:::(see [[Template:Maplink/testcases/overlays]] to view examples)
::;overlay-horizontal-alignment
:::Horizontal alignment of overlay, either <code>left</code> or <code>right</code>; default is <code>right</code>
::;overlay-vertical-alignment
:::Vertical alignment of overlay, either <code>top</code> or <code>bottom</code>; default is <code>bottom</code>
::;overlay-horizontal-offset {{nobold|and}} overlay-vertical-offset
:::Optional – number of pixels to offset the overlay in from the edge of the map, e.g. <code>10</code> for a 10 pixel gap
::;overlay-border
:::CSS style for the border, e.g. <code>3px solid black</code>; default is <code>1px solid white</code>. The colour can be any [[web color]] name or hex code.
===Raw GeoJSON===
Baris 147 ⟶ 202:
===For each feature===
Multiple features can be displayed on a single map. For each additional feature, add a sequential number to the end of the parameter name. For example, the second uses parameters like {{para|type2}}, {{para|id2}}, etc., the third feature {{para|type3}}, {{para|id3}}, etc., and so on. Higher numbers are drawn on top.
;type
:Type of data. Valid values are:
Baris 155 ⟶ 210:
::<code>data</code> – a geoJSON data page on Commons (parameter is optional in this case)
::<code>point</code> – a point feature (coordinates)
::<code>named</code> – all named coordinates in an page or section ({{tlx|coord}} templates with {{para|name}} parameter)
::<code>circle</code> – a circle centred on a point's coordinates
;id
:''(or '''ids''')''
:Wikidata id (Q-number) of the point feature, Wikidata id that the OSM line/shape feature is tagged with. Separate multiple ids with a comma. Defaults to the current page's Wikidata id (if {{para|from}} not set).
;from
:Source of map data:
:*If '''type''' is <code>data</code> or omitted: The JSON (.map) file from Commons to display (excluding the <code>Data:</code> prefix)
:*If '''type''' is <code>named</code>: Page name, or name#section, to get named coordinates from. If omitted, or specified as just #section, then current page will be used.
;title
:Title of the feature (for features from OSM), displayed when the feature is clicked on; default is the page title
Baris 169 ⟶ 228:
;stroke-width
:Width for the lines used to draw the feature (for features from OSM); default is <code>6</code>
;stroke-opacity
:Opacity for the lines used to draw the feature (for features from OSM) – a number between <code>0</code> (fully transparent) and <code>1</code> (fully opaque); default is <code>1</code>
;fill
:Color code for the fill color of the feature (for shape or shape-inverse features from OSM); default is <code>#000000</code> (black). Note that a semi-transparent version of the specified color will be used by default, allowing the map below to still be seen.
;fill-opacity
:Opacity for the fill color of the feature (for shape or shape-inverse features from OSM) – a number between <code>0</code> (fully transparent) and <code>1</code> (fully opaque); default is <code>0.5</code>
;{{anchor|coord}}coord
:Coordinates to display for a point feature. Use {{tl|Coord}} template to specify coordinates {{small|1=(e.g. {{para|coord|2=<nowiki>{{Coord|12.34|S|56.78|W}}</nowiki>}})}}. If not set, coordinates will be retrieved from Wikidata.
;marker
:Name of Maki marker image to display at the point feature. See [[mw:Maps/Icons]] for options. If not set, a plain marker will be shown without an image.
Baris 176 ⟶ 241:
:''(or '''marker-colour''')''
:Color code ([[Web colors#Hex triplet|Hex triplet]]) specifying marker background color. Default is <code>5E74F3</code> ({{Color box|#5E74F3}})
;marker-size
:Size of the marker. Can be <code>small</code>, <code>medium</code> (default) or <code>large</code>.
;radius
:''(or '''radius_m'''), or alternative parameters '''radius_km''', or '''radius_mi''', or '''radius_ft'''''
:Radius of the circle. In metres by default, or in kilometers or miles or feet if the alternative parameters are used.
;edges
:Number of edges used to construct the circle. Default is <code>32</code>. Higher numbers will result in a smoother circle but use more Lua processing resources.
==
An option for [[Template:Switcher]]-style switching of multiple mapframes, where specified parameters like zoom, or frame coordinates, or a shape's item id are switched between different values. When using, ensure the number of values in each list are the same.
Instructions:
# Add parameter '''switch''' to specify labels for the different options: a list separated by either{{code|,}}, or {{code|;}} if the labels contain commas, or {{code|###}} if the labels contain semi-colons. Each label will be displayed with a prefix of "Show ".
#:Example: {{para|switch|zoomed out, zoomed mid, zoomed in}}
# For each parameter that is to be switched, set its value to {{kbd|SWITCH:}} followed by a list of values to switch between, again separated by {{code|,}} or {{code|;}} or {{code|###}}
#:Example: {{para|zoom|SWITCH:4,9,14}}
#:Parameters '''frame''', '''plain''', and '''text''' should not be switched
#Make sure each list has the same number of entries. The position of value in a {{kbd|SWITCH:}} list corresponds to the same position in the list of labels set in {{para|switch}}.
Example: {{mapframe|frame=yes|type=point|id=Q100|text=Boston|zoom=SWITCH:4,9,14|switch=zoomed out, zoomed mid, zoomed in}}
<pre>{{mapframe|frame=yes|type=point|id=Q100|text=Boston|zoom=SWITCH:4,9,14|switch=zoomed out, zoomed mid, zoomed in}}</pre>
{{-}}
==Contoh dan tips==
===Banyak fitur===
Multiple features allow you to:
*Use external data from both Wikimedia Commons and OpenStreetMap together
Baris 209 ⟶ 295:
{{-}}
===
Mapframes can be included in infoboxes. Using {{para|plain|yes}} to remove the outer frame is recommended.
Baris 241 ⟶ 327:
</pre>
(Link to GeoJSON data subpage: [[Wikipedia:Map data/Main Roads Western Australia/Forrest Highway]])
====Raw Wikidata query
{{maplink|frame=yes|text=Ten countries|raw={
"type": "ExternalData",
"service": "geoshape",
"query": "
SELECT * WHERE {
?id wdt:P463 wd:Q1065 .
} LIMIT 10
"}
|frame-width=600|frame-height=400|frame-lat=25|frame-long=10|zoom=1
}}
<pre style=min-width:30em>
{{maplink|frame=yes|text=Ten countries|raw={
"type": "ExternalData",
"service": "geoshape",
"query": "
SELECT * WHERE {
?id wdt:P463 wd:Q1065 .
} LIMIT 10
"}
|frame-width=600|frame-height=400|frame-lat=25|frame-long=10|zoom=1
}}
</pre>
{{-}}
{{maplink|frame=yes|raw={
"type": "ExternalData",
Baris 247 ⟶ 357:
"query": "
SELECT ?id ?head
(SAMPLE(?img) as ?
(min(?partyId) as ?party)
(if(?party = '0', '#800000', if(?party = '1', '#000080', '#008000')) as ?fill)
(concat('[[', substr(str(?link),31,500), '{{!}}', ?headLabel, ']]') as ?title)
(concat(?stateLabel, '\\n', '[[File:', substr(str(?
WHERE {
?id wdt:P31 wd:Q35657 .
Baris 275 ⟶ 385:
"query": "
SELECT ?id ?head
(SAMPLE(?img) as ?
(min(?partyId) as ?party)
(if(?party = '0', '#800000', if(?party = '1', '#000080', '#008000')) as ?fill)
(concat('[[', substr(str(?link),31,500), '{{!}}', ?headLabel, ']]') as ?title)
(concat(?stateLabel, '\\n', '[[File:', substr(str(?
WHERE {
?id wdt:P31 wd:Q35657 .
Baris 300 ⟶ 410:
{{-}}
=== Hal yang perlu diperhatikan ===
*When retrieving lines or shapes from OSM, you can't style the fill color or the opacity level of fills or strokes (unless you use the {{para|raw}} parameter)
*The following code utilising the {{para|raw}} parameter won't work because the curly brace to close the GeoJSON is adjacent to the curly braces to close the template:
Baris 306 ⟶ 416:
:To fix it, put a space before the two template braces or move them to a separate line.
<!-- Tutorial -->
== Pengalihan ==
* {{tlf|Mapframe}}
==
*[[Templat:Mapbox]] – turunan dari templat ini yang meletakkan pranala di dalam sebuah kotak info.
*[[Template:Attached KML]]
<includeonly>{{sandbox other||
[[Kategori:Templat_berbasis_Lua]]
[[Kategori:Templat_koordinat]]
[[Kategori:Templat_peta]]
}}</includeonly>
|