![]() | This template uses Lua: |
This template adds a link, or frame, which will display map data – either from:
Note:
Data:
namespace and ends in .map
– see mw:Help:Map Data for further information.This template is intended for linear or polygon features, including (but not limited to):
and more... This template can also be used to display point features on a map, i.e. coordinates.
Basic usage
{{maplink|from=}}
(specify .map data page in from=, excluding Data prefix){{maplink|raw=}}
(specify raw GeoJSON, preferably transcluded from a subpage of Wikipedia:Map data){{maplink|type=line|id=}}
(Wikidata id only required if another article's Wikidata page is to be used){{maplink|type=shape|id=}}
(Wikidata id only required if another article's Wikidata page is to be used){{maplink|type=shape-inverse|id=}}
(Wikidata id only required if another article's Wikidata page is to be used){{maplink|type=point|id=}}
(Wikidata id only required if another article's Wikidata page is to be used){{maplink|type=point|coord=}}
(specify coordinates using {{Coord}} template){{maplink|type=circle|radius=|id=}}
(Wikidata id only required if another article's Wikidata page is to be used){{maplink|type=circle|radius=|coord=}}
(specify coordinates using {{Coord}} template)|frame=yes
.Full parameter set – data page
{{maplink |display= |from= |zoom= |text= |icon= }}
Full parameter set – raw data
{{maplink |display= |raw= <!-- preferably {{Wikipedia:Map data/subpage}} --> |zoom= |text= |icon= }}
Full parameter set – geoline/geoshape
{{maplink |display= |type= |id= |title= |description= |stroke-color= |stroke-width= |zoom= |text= |icon= }}
Full parameter set – point features/coordinates
{{maplink |display= |type=point |id= |title= |description= |coord= |marker= |zoom= |text= |icon= }}
Full parameter set – circles
{{maplink |display= |type=circle |radius= <!-- in metres, alternative parameters available for other units --> |id= |title= |description= |coord= |marker= |zoom= |text= |icon= }}
inline
- Only displays the inline link (you can forego this, as it is the default)title
- Only displays the title linkinline,title
- Displays the inline link as well as the title linktitle,inline
- Same as above1
to 19
(larger numbers zoom in further); default is automatically determined by the mapMapframe parameters (only work with inline display)
left
, center
, or right
; default is right
300
200
|frame-coordinates={{Coord|12.34|S|56.78|W}}
). If not set, coordinates will be retrieved from Wikidata.|frame-coordinates=
or |frame-coord=
is set)|frame-coordinates=
or |frame-coord=
is set)|coord=
(if set), or|id=
parameter, or for the page the template is placed on)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 |type2=
, |id2=
, etc., the third feature |type3=
, |id3=
, etc., and so on.
line
– a geoline feature from OSM (e.g. a road)shape
– a geoshape feature from OSM (e.g. a state or province)shape-inverse
– a geomask feature from OSM (the inverse of a geoshape - allows an unobstructed view of the map beneath)data
– a geoJSON data page on Commons (parameter is optional in this case)point
– a point feature (coordinates)circle
– a circle centred on a point's coordinates|from=
not set).Data:
prefix)#ff0000
(red)6
0
(fully transparent) and 1
(fully opaque); default is 1
#000000
(black). Note that a semi-transparent version of the specified color will be used by default, allowing the map below to still be seen.0
(fully transparent) and 1
(fully opaque); default is 0.5
|coord={{Coord|12.34|S|56.78|W}}
). If not set, coordinates will be retrieved from Wikidata.5E74F3
( )32
. Higher numbers will result in a smoother circle but use more Lua processing resources.Multiple features allow you to:
{{Maplink|frame=yes |type=shape|id=Q3495894|title=Shape|description=Description of shape |type2=line|id2=Q1318331|title2=Line|description2=Description of line |type3=point|coord3={{coord|32|S|116|E}}|title3=Point|description3=Description of point }}
{{Maplink|frame=yes|plain=yes|frame-width=250|frame-height=280|zoom=6|frame-lat=29.185|frame-long=76.225 |type=shape-inverse|id=Q1174|title=Haryana |type2=point|id2=Q200663|stroke-width=3|title2=Faridabad }}
Mapframes can be included in infoboxes. Using |plain=yes
to remove the outer frame is recommended.
For simple cases with a single feature, {{infobox mapframe}}
can be used instead (see that template's documentation for details).
Mitchell Freeway | |
---|---|
![]() | |
Map of Perth's northern suburbs with Mitchell Freeway highlighted in red | |
Type | Freeway |
{{Infobox Australian road | location = {{maplink |type=line |frame=yes |plain=yes |frame-align=center |frame-lat=-31.8262 |frame-long=115.7877 |zoom=9}} ... (other parameters omitted) ... }}
The "raw" parameter allows the same inputs as the full <maplink> function. It allows you to:
See mw:Help:Extension:Kartographer for instructions.
{{maplink|raw={{Wikipedia:Map data/Main Roads Western Australia/Forrest Highway}}|text=Route map}}
(Link to GeoJSON data subpage: Wikipedia:Map data/Main Roads Western Australia/Forrest Highway)
{{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 }}
{{maplink|frame=yes|raw={ "type": "ExternalData", "service": "geoshape", "query": " SELECT ?id ?head (SAMPLE(?img) as ?img) (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(?img), 52, 500), '{{!}}200px]]') as ?description) WHERE { ?id wdt:P31 wd:Q35657 . ?id wdt:P6 ?head . ?head wdt:P102 ?party . BIND(if(?party = wd:Q29468, '0', if(?party = wd:Q29552, '1', '2')) as ?partyId) SERVICE wikibase:label { bd:serviceParam wikibase:language 'en' . ?head rdfs:label ?headLabel . ?id rdfs:label ?stateLabel . } OPTIONAL { ?head wdt:P18 ?img . } ?link schema:about ?head . ?link schema:isPartOf <https://en.wikipedia.org/> . } GROUP BY ?id ?head ?headLabel ?link ?stateLabel "}|frame-width=600|frame-height=400|frame-lat=52|frame-long=-110|zoom=3}}
|raw=
parameter)|raw=
parameter won't work because the curly brace to close the GeoJSON is adjacent to the curly braces to close the template:{{Maplink|raw= {"type": "ExternalData","service": "geoshape","ids": "Q13518258"}}}