Jump to content
 







Main menu
   


Navigation  



Main page
Contents
Current events
Random article
About Wikipedia
Contact us
Donate
 




Contribute  



Help
Learn to edit
Community portal
Recent changes
Upload file
 








Search  

































Create account

Log in
 









Create account
 Log in
 




Pages for logged out editors learn more  



Contributions
Talk
 



















Contents

   



(Top)
 


1 Uses  





2 Usage  





3 Parameters  



3.1  For overall display  





3.2  Raw GeoJSON  





3.3  For each feature  





3.4  TemplateData  







4 Multiple map switcher  





5 Examples and tips  



5.1  Multiple features  





5.2  Infoboxes  





5.3  The raw parameter  



5.3.1  Raw GeoJSON example  





5.3.2  Raw Wikidata query examples  







5.4  Gotchas  







6 Tutorials  





7 FAQ  





8 Redirects  





9 See also  














Template:Maplink






Afrikaans
Alemannisch
Ænglisc
العربية
Авар
Azərbaycanca
تۆرکجه
Basa Bali

 / Bân-lâm-gú
Беларуская (тарашкевіца)

Bikol Central
Български
Boarisch
Bosanski
Буряад
Cebuano
Cymraeg
Dansk
Deutsch
Ελληνικά
Español
Esperanto
Euskara
فارسی
Français

/Hak-kâ-ngî

Հայերեն
ि
Hrvatski
Ilokano
Bahasa Indonesia
Interlingua
Íslenska
Italiano
Jawa

Kapampangan

Қазақша
Kurdî
Ladin
Latviešu
Lietuvių
Magyar
ि
Македонски


مازِرونی
Bahasa Melayu
Minangkabau
 / Mìng-dĕ̤ng-nḡ
Мокшень
Монгол

Nederlands


Nordfriisk
Norsk bokmål
Norsk nynorsk
Oʻzbekcha / ўзбекча

Papiamentu

Plattdüütsch
Português
Română
Русский
Scots

Simple English
سنڌي
Slovenčina
Slovenščina
Ślůnski
کوردی
Српски / srpski
Sunda
Suomi
Svenska
Tagalog
ி
 



Türkçe
Türkmençe
Українська
اردو
Tiếng Vit

Winaray


 
 

Edit links
 









Template
Talk
 

















Read
View source
View history
 








Tools
   


Actions  



Read
View source
View history
 




General  



What links here
Related changes
Upload file
Special pages
Permanent link
Page information
Get shortened URL
Download QR code
Wikidata item
 




Print/export  



Download as PDF
Printable version
 




In other projects  



Wikimedia Commons
Meta-Wiki
Wikivoyage
 
















Appearance
   

 





Permanently protected template

From Wikipedia, the free encyclopedia
 


Map
Mapframe

MaplinkMaplink

This template adds a link, or frame, which will display a map from OpenStreetMap together with specified map data. The map and data can be viewed in a scrollable and zoomable fullscreen window. The map data can come from:

Note:

Uses

This template is intended to show points as well as linear or polygon features on a map, including (but not limited to):

and more... This template can also be used to display point features on a map, i.e. coordinates.

Usage

Basic usage

Parameter set – data page

{{maplink
|display=
|from=
|zoom=
|text=
|icon=
}}

Parameter set – raw data

{{maplink
|display=
|raw= <!-- preferably {{Wikipedia:Map data/subpage}} -->
|zoom=
|text=
|icon=
}}

Parameter set – geoline/geoshape

{{maplink
|display=
|type=
|id=
|title=
|description=
|stroke-color=
|stroke-width=
|zoom=
|text=
|icon=
}}

Parameter set – point features/coordinates

{{maplink
|display=
|type=point
|id=
|title=
|description=
|coord=
|marker=
|zoom=
|text=
|icon=
}}


Parameter set – circles

{{maplink
|display=
|type=circle
|radius=  <!-- in metres, alternative parameters available for other units --> 
|id=
|title=
|description=
|coord=
|marker=
|zoom=
|text=
|icon=
}}

Parameters

For overall display

display
How the template is displayed. Valid values are:
inline - Only displays the inline link (you can forego this, as it is the default)
title - Only displays the title link
inline,title - Displays the inline link as well as the title link
title,inline - Same as above
text
Text to display for the link (or caption if using mapframe); default is "Map"
icon
Set to "no" to turn off the icon that appears next to the link
zoom
Zoom level, from 1to19 (larger numbers zoom in further); default is automatically determined by the map, unless the only feature is a single point.

Mapframe parameters (only work with inline display)

frame
Set to "yes" to show a map frame instead of a link
plain
Set to "yes" to show just the map without the surrounding frame, and without a caption (text parameter will be ignored)
frame-align
Alignment with respect to the page: left, center, or right; default is right
frame-width
Width of the map frame in pixels, default is 300
frame-height
Height of the map frame in pixels, default is 200
frame-coordinates
(orframe-coord)
Optional - coordinates of the center of the map. Use {{Coord}} template to specify coordinates (e.g. |frame-coordinates={{Coord|12.34|S|56.78|W}}). If not set, coordinates will be retrieved from Wikidata.
frame-latitude
(orframe-lat)
(ignored if |frame-coordinates=or|frame-coord= is set)
Optional - latitude coordinate for center of the map.
frame-longitude
(orframe-long)
(ignored if |frame-coordinates=or|frame-coord= is set)
Optional - longitude coordinate for center of the map.
information 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 |coord= (if set), or
  • Retrieved from Wikidata (if available – for either the item specified in |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.
|overlay=[[File:Example.svg|140x140px]]or
|overlay={{maplink|frame=yes|plain=yes|frame-width=100|frame-height=100|type=shape|id={{get QID|French submarine Ariane (1914)}}|frame-align=center}}or
|overlay={{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}}
(see Template:Maplink/testcases/overlays to view examples)
overlay-horizontal-alignment
Horizontal alignment of overlay, either leftorright; default is right
overlay-vertical-alignment
Vertical alignment of overlay, either toporbottom; default is bottom
overlay-horizontal-offset and overlay-vertical-offset
Optional – number of pixels to offset the overlay in from the edge of the map, e.g. 10 for a 10 pixel gap
overlay-border
CSS style for the border, e.g. 3px solid black; default is 1px solid white. The colour can be any web color name or hex code.

Raw GeoJSON

raw
Raw GeoJSON (preferably transcluded from a subpage of Wikipedia:Map data) as well as <maplink> functionality not available via the other parameters. See below for more information.

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 |type2=, |id2=, etc., the third feature |type3=, |id3=, etc., and so on. Higher numbers are drawn on top.

type
Type of data. Valid values are:
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)
named – all named coordinates in an page or section ({{coord}} templates with |name= parameter)
circle – a circle centred on a point's coordinates
id
(orids)
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|from= not set).
from
Source of map data:
  • Iftypeisdata or omitted: The JSON (.map) file from Commons to display (excluding the Data: prefix)
  • Iftypeisnamed: 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
description
Description of the feature (for features from OSM), displayed when the feature is clicked on; optional
stroke-color
(orstroke-colour)
Color code for the color used to draw the feature (for features from OSM); default is #ff0000 (red)
stroke-width
Width for the lines used to draw the feature (for features from OSM); default is 6
stroke-opacity
Opacity for the lines used to draw the feature (for features from OSM) – a number between 0 (fully transparent) and 1 (fully opaque); default is 1
fill
Color code for the fill color of the feature (for shape or shape-inverse features from OSM); default is #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.
fill-opacity
Opacity for the fill color of the feature (for shape or shape-inverse features from OSM) – a number between 0 (fully transparent) and 1 (fully opaque); default is 0.5
coord
Coordinates to display for a point feature. Use {{Coord}} template to specify coordinates (e.g. |coord={{Coord|12.34|S|56.78|W}}). 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.
marker-color
(ormarker-colour)
Color code (Hex triplet) specifying marker background color. Default is 5E74F3 ( )
marker-size
Size of the marker. Can be small, medium (default) or large.
radius
(orradius_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 32. Higher numbers will result in a smoother circle but use more Lua processing resources.

TemplateData

Adds a link, or frame, which will display map data

Template parameters[Edit template data]

ParameterDescriptionTypeStatus
displaydisplay

How the template is displayed

Suggested values
inline title inline,title
Default
inline
Unknownoptional
texttext

Text to display for the link (or caption if using mapframe)

Default
Map
Lineoptional
iconicon

Set to "no" to turn off the icon that appears next to the link

Booleanoptional
zoomzoom

Zoom level, from 1 to 19 (larger numbers zoom in further); default is automatically determined by the map, unless the only feature is a single point.

Numberoptional

Multiple map switcher

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:

  1. Add parameter switch to specify labels for the different options: a list separated by either,, or ; if the labels contain commas, or ### if the labels contain semi-colons. Each label will be displayed with a prefix of "Show ".
    Example: |switch=zoomed out, zoomed mid, zoomed in
  2. For each parameter that is to be switched, set its value to SWITCH: followed by a list of values to switch between, again separated by ,or;or###
    Example: |zoom=SWITCH:4,9,14
    Parameters frame, plain, and text should not be switched
  3. Make sure each list has the same number of entries. The position of value in a SWITCH: list corresponds to the same position in the list of labels set in |switch=.
Example:

Map

Map

Map

Boston
{{mapframe|frame=yes|type=point|id=Q100|text=Boston|zoom=SWITCH:4,9,14|switch=zoomed out, zoomed mid, zoomed in}}

Examples and tips

Multiple features

Multiple features allow you to:

Map
Map
{{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
}}

Map

{{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
}}

Infoboxes

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

Map of Perth's northern suburbs with Mitchell Freeway highlighted in red

TypeFreeway
{{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

The "raw" parameter allows the same inputs as the full <maplink> function. It allows you to:

See mw:Help:Extension:Kartographer for instructions.

Raw GeoJSON example

Route map

{{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)

Raw Wikidata query examples

Map
Ten countries
{{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
}}
Map
Map
{{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}}

Gotchas

{{Maplink|raw= {"type": "ExternalData","service": "geoshape","ids": "Q13518258"}}}
To fix it, put a space before the two template braces or move them to a separate line.

Tutorials

FAQ

Q1: Where to file a bug report when there is a problem with the base map? (e.g. a missing lake)
A1: If the problem also occurs on OpenStreetMap, it needs to be fixed there. If the problem is only on Wikimedia's maps, it can be reported on Phabricator (you can log in with you Wikipedia account). See mw:How to report a bug for instructions (for the tags, use Maps). (Alternatively, you can try mw:Help talk:Extension:Kartographer)
Q2: Where to report other bugs or problems with the maps?
A2: This may be a problem with the Wikipedia module, or it may be an underlying software bug (there are lots of those).
  • If the problem only occurs with Wikipedia's template/module, or you're not sure, report it here. (Alternatively, you can try Wikipedia:Village pump (technical))
  • Q3: Why does the thumbnail map render as a static image when viewing pages, but is interactive when editing pages?
    A3: On Wikipedia, and most wikis other than Wikivoyage, the emdeded thumbnail is a static map, and the full screen map needs to be opened before the map can be zoomed or panned. This is for for performance reasons, and to present some content if javascript is disabled, and for printing.
    That preview mode shows an interactive map is a bug, phab:T203863 (and also a performance issue). Further explanation can be found in the comments on phab:T202793.
    Q4: Why is a line or shape feature from OpenStreetMap not being shown?
    A4: There are several possible causes:
  • Only certain OSM relations (those with type=multipolygon, type=route, type=waterway and type=boundary) can be used, and not others like buildings and public transport master routes. See mw:Help:Extension:Kartographer/OSM#Limitation and phab:T156433.
  • It can take 1 or 2 days after tagging on OSM before the data is available here.
  • Wikimedia occasionally has problems replicating OSM data (e.g. phab:T218097), or intentionally disables replication due to other problems (e.g. phab:T243609)
  • Q5: Why are line, shape, or point features are not shown after editing or adding a map, even though they were shown in the page preview?
    A5: This is a bug related to generating thumbnail map images. It should fix itself in an hour or two. See phab:T269984 for details.
    Q6: A page using mapframe's |raw= parameter is showing error messages of "The time allocated for running scripts has expired." What can be done?
    A6: If the amount of raw data to be processed is too large, that timeout message may be shown. You can try moving the raw data to Commons (example) or replacing the mapframe template with the equivalent wikitext using Special:ExpandTemplates (example)

    Redirects

    See also


    Retrieved from "https://en.wikipedia.org/w/index.php?title=Template:Maplink&oldid=842263010"

    Categories: 
    Lua-based templates
    Templates using data from Wikidata
    Coordinates templates
    Map templates
    Hidden categories: 
    Pages using the Graph extension
    Pages with disabled graphs
    Wikipedia template-protected templates
    Pages using the Kartographer extension
     



    This page was last edited on 21 May 2018, at 09:34 (UTC).

    Text is available under the Creative Commons Attribution-ShareAlike License 4.0; additional terms may apply. By using this site, you agree to the Terms of Use and Privacy Policy. Wikipedia® is a registered trademark of the Wikimedia Foundation, Inc., a non-profit organization.



    Privacy policy

    About Wikipedia

    Disclaimers

    Contact Wikipedia

    Code of Conduct

    Developers

    Statistics

    Cookie statement

    Mobile view



    Wikimedia Foundation
    Powered by MediaWiki