Using templates with the Maps extension works a bit different compared to "usual" SemanticMediaWiki templates. In usual templates the parameter {{{1}}}
usually represents the page title. In templates used with Maps {{{1}}}
represents the property that comes after the ?Has coordinates
property. See the second example for an example.
If one wants to printout the page title within the template one can use {{{title}}}
. To print out the coordinates one can use {{{latitude}}}
and {{{longitude}}}
.
First example[edit]
Adding a link to maps.google.com by using a template. See template "Google Maps Link".
Using the template parameter might be broken in some versions of the
Extension "Maps" extension.
1
{{#ask:
[[Category:Locations]]
|?Has coordinates
|format=leaflet
|template=Google Maps Link
}}
Loading map...
{"format":"leaflet","minzoom":false,"maxzoom":false,"limit":50,"offset":0,"link":"all","sort":[""],"order":[],"headers":"show","mainlabel":"","intro":"","outro":"","searchlabel":"... further results","default":"","import-annotation":false,"width":"auto","height":"350px","centre":false,"title":"","label":"","icon":"","lines":[],"polygons":[],"circles":[],"rectangles":[],"copycoords":false,"static":false,"zoom":false,"defzoom":14,"layers":["OpenStreetMap"],"image layers":[],"overlays":[],"resizable":false,"fullscreen":false,"scrollwheelzoom":true,"cluster":false,"clustermaxzoom":20,"clusterzoomonclick":true,"clustermaxradius":80,"clusterspiderfy":true,"geojson":"","clicktarget":"","showtitle":true,"hidenamespace":false,"template":"Google Maps Link","userparam":"","activeicon":"","pagelabel":false,"ajaxcoordproperty":"","ajaxquery":"","locations":[{"text":"\u003Cb\u003E\u003Ca href=\"/wiki/Asia\" title=\"Asia\"\u003EAsia\u003C/a\u003E\u003C/b\u003E\u003Cp\u003E\u003Ca rel=\"nofollow\" class=\"external text\" href=\"https://maps.google.com/?ie=UTF8\u0026amp;ll=34.04786,100.61966\"\u003EView on Google Maps\u003C/a\u003E\n\u003C/p\u003E","title":"Asia","link":"","lat":34.04786,"lon":100.61966,"icon":""},{"text":"\u003Cb\u003E\u003Ca href=\"/wiki/Belgium\" title=\"Belgium\"\u003EBelgium\u003C/a\u003E\u003C/b\u003E\u003Cp\u003E\u003Ca rel=\"nofollow\" class=\"external text\" href=\"https://maps.google.com/?ie=UTF8\u0026amp;ll=50.503887,4.469936\"\u003EView on Google Maps\u003C/a\u003E\n\u003C/p\u003E","title":"Belgium","link":"","lat":50.503887,"lon":4.469936,"icon":""},{"text":"\u003Cb\u003E\u003Ca href=\"/wiki/Brussels\" title=\"Brussels\"\u003EBrussels\u003C/a\u003E\u003C/b\u003E\u003Cp\u003E\u003Ca rel=\"nofollow\" class=\"external text\" href=\"https://maps.google.com/?ie=UTF8\u0026amp;ll=50.8503396,4.3517103\"\u003EView on Google Maps\u003C/a\u003E\n\u003C/p\u003E","title":"Brussels","link":"","lat":50.8503396,"lon":4.3517103,"icon":""},{"text":"\u003Cb\u003E\u003Ca href=\"/wiki/Coasting\" title=\"Coasting\"\u003ECoasting\u003C/a\u003E\u003C/b\u003E\u003Cp\u003E\u003Ca rel=\"nofollow\" class=\"external text\" href=\"https://maps.google.com/?ie=UTF8\u0026amp;ll=41.46141,12.66777\"\u003EView on Google Maps\u003C/a\u003E\n\u003C/p\u003E","title":"Coasting","link":"","lat":41.46141,"lon":12.66777,"icon":""},{"text":"\u003Cb\u003E\u003Ca href=\"/wiki/Externsteine\" title=\"Externsteine\"\u003EExternsteine\u003C/a\u003E\u003C/b\u003E\u003Cp\u003E\u003Ca rel=\"nofollow\" class=\"external text\" href=\"https://maps.google.com/?ie=UTF8\u0026amp;ll=51.867863,8.9180267\"\u003EView on Google Maps\u003C/a\u003E\n\u003C/p\u003E","title":"Externsteine","link":"","lat":51.867863,"lon":8.9180267,"icon":""},{"text":"\u003Cb\u003E\u003Ca href=\"/wiki/Gent\" title=\"Gent\"\u003EGent\u003C/a\u003E\u003C/b\u003E\u003Cp\u003E\u003Ca rel=\"nofollow\" class=\"external text\" href=\"https://maps.google.com/?ie=UTF8\u0026amp;ll=51.053468,3.73038\"\u003EView on Google Maps\u003C/a\u003E\n\u003C/p\u003E","title":"Gent","link":"","lat":51.053468,"lon":3.73038,"icon":""},{"text":"\u003Cb\u003E\u003Ca href=\"/wiki/Hamburg\" title=\"Hamburg\"\u003EHamburg\u003C/a\u003E\u003C/b\u003E\u003Cp\u003E\u003Ca rel=\"nofollow\" class=\"external text\" href=\"https://maps.google.com/?ie=UTF8\u0026amp;ll=53.5510846,9.9936818\"\u003EView on Google Maps\u003C/a\u003E\n\u003C/p\u003E","title":"Hamburg","link":"","lat":53.5510846,"lon":9.9936818,"icon":""},{"text":"\u003Cb\u003E\u003Ca href=\"/wiki/Khabarovsk\" title=\"Khabarovsk\"\u003EKhabarovsk\u003C/a\u003E\u003C/b\u003E\u003Cp\u003E\u003Ca rel=\"nofollow\" class=\"external text\" href=\"https://maps.google.com/?ie=UTF8\u0026amp;ll=48.485637,135.0795875\"\u003EView on Google Maps\u003C/a\u003E\n\u003C/p\u003E","title":"Khabarovsk","link":"","lat":48.485637,"lon":135.0795875,"icon":""},{"text":"\u003Cb\u003E\u003Ca href=\"/wiki/Netherlands\" title=\"Netherlands\"\u003ENetherlands\u003C/a\u003E\u003C/b\u003E\u003Cp\u003E\u003Ca rel=\"nofollow\" class=\"external text\" href=\"https://maps.google.com/?ie=UTF8\u0026amp;ll=52.160454557747,5.625\"\u003EView on Google Maps\u003C/a\u003E\n\u003C/p\u003E","title":"Netherlands","link":"","lat":52.160454557747,"lon":5.625,"icon":""},{"text":"\u003Cb\u003E\u003Ca href=\"/wiki/Norway\" title=\"Norway\"\u003ENorway\u003C/a\u003E\u003C/b\u003E\u003Cp\u003E\u003Ca rel=\"nofollow\" class=\"external text\" href=\"https://maps.google.com/?ie=UTF8\u0026amp;ll=60.472024,8.468946\"\u003EView on Google Maps\u003C/a\u003E\n\u003C/p\u003E","title":"Norway","link":"","lat":60.472024,"lon":8.468946,"icon":""},{"text":"\u003Cb\u003E\u003Ca href=\"/wiki/Portugal\" title=\"Portugal\"\u003EPortugal\u003C/a\u003E\u003C/b\u003E\u003Cp\u003E\u003Ca rel=\"nofollow\" class=\"external text\" href=\"https://maps.google.com/?ie=UTF8\u0026amp;ll=39.567870063777,-8.81103515625\"\u003EView on Google Maps\u003C/a\u003E\n\u003C/p\u003E","title":"Portugal","link":"","lat":39.567870063777,"lon":-8.81103515625,"icon":""}],"imageLayers":[]}
Second example[edit]
Custom formatting of the queried properties using the template and showtitle parameters. See used template "Location Popup".
{{#ask:
[[Category:Locations]]
|?Has coordinates
|?Has location type
|?Located in
|format=leaflet
|template=Location Popup
|showtitle=off
|icon=Blue_marker.png
}}
In this example the property Has location type
can be printed out in the template with {{{1}}}
. The property Located in
can be printed out in the template with {{{2}}}
.
Loading map...
{"format":"leaflet","minzoom":false,"maxzoom":false,"limit":50,"offset":0,"link":"all","sort":[""],"order":[],"headers":"show","mainlabel":"","intro":"","outro":"","searchlabel":"... further results","default":"","import-annotation":false,"width":"auto","height":"350px","centre":false,"title":"","label":"","icon":"Blue_marker.png","lines":[],"polygons":[],"circles":[],"rectangles":[],"copycoords":false,"static":false,"zoom":false,"defzoom":14,"layers":["OpenStreetMap"],"image layers":[],"overlays":[],"resizable":false,"fullscreen":false,"scrollwheelzoom":true,"cluster":false,"clustermaxzoom":20,"clusterzoomonclick":true,"clustermaxradius":80,"clusterspiderfy":true,"geojson":"","clicktarget":"","showtitle":false,"hidenamespace":false,"template":"Location Popup","userparam":"","activeicon":"","pagelabel":false,"ajaxcoordproperty":"","ajaxquery":"","locations":[{"text":"\u003Cp\u003EThe \u003Ca href=\"/wiki/Continent\" title=\"Continent\"\u003EContinent\u003C/a\u003E \u003Cb\u003E\u003Ca href=\"/wiki/Asia\" title=\"Asia\"\u003EAsia\u003C/a\u003E\u003C/b\u003E is located in [[{{{2}}}]].\n\u003C/p\u003E","title":"Asia","link":"","lat":34.04786,"lon":100.61966,"icon":"/w/images/6/6f/Blue_marker.png"},{"text":"\u003Cp\u003EThe \u003Ca href=\"/wiki/Country\" title=\"Country\"\u003ECountry\u003C/a\u003E \u003Cb\u003E\u003Ca href=\"/wiki/Belgium\" title=\"Belgium\"\u003EBelgium\u003C/a\u003E\u003C/b\u003E is located in \u003Ca href=\"/wiki/Europe\" title=\"Europe\"\u003EEurope\u003C/a\u003E.\n\u003C/p\u003E","title":"Belgium","link":"","lat":50.503887,"lon":4.469936,"icon":"/w/images/6/6f/Blue_marker.png"},{"text":"\u003Cp\u003EThe \u003Ca href=\"/wiki/City\" title=\"City\"\u003ECity\u003C/a\u003E \u003Cb\u003E\u003Ca href=\"/wiki/Brussels\" title=\"Brussels\"\u003EBrussels\u003C/a\u003E\u003C/b\u003E is located in \u003Ca href=\"/wiki/Belgium\" title=\"Belgium\"\u003EBelgium\u003C/a\u003E.\n\u003C/p\u003E","title":"Brussels","link":"","lat":50.8503396,"lon":4.3517103,"icon":"/w/images/6/6f/Blue_marker.png"},{"text":"\u003Cp\u003EThe \u003Ca href=\"/wiki/Local_place\" title=\"Local place\"\u003ELocal place\u003C/a\u003E \u003Cb\u003E\u003Ca href=\"/wiki/Coasting\" title=\"Coasting\"\u003ECoasting\u003C/a\u003E\u003C/b\u003E is located in \u003Ca href=\"/w/index.php?title=Nettuno\u0026amp;action=edit\u0026amp;redlink=1\" class=\"new\" title=\"Nettuno (page does not exist)\"\u003ENettuno\u003C/a\u003E.\n\u003C/p\u003E","title":"Coasting","link":"","lat":41.46141,"lon":12.66777,"icon":"/w/images/6/6f/Blue_marker.png"},{"text":"\u003Cp\u003EThe \u003Ca href=\"/wiki/Local_place\" title=\"Local place\"\u003ELocal place\u003C/a\u003E \u003Cb\u003E\u003Ca href=\"/wiki/Externsteine\" title=\"Externsteine\"\u003EExternsteine\u003C/a\u003E\u003C/b\u003E is located in \u003Ca href=\"/wiki/Demo:Germany\" title=\"Demo:Germany\"\u003EGermany\u003C/a\u003E.\n\u003C/p\u003E","title":"Externsteine","link":"","lat":51.867863,"lon":8.9180267,"icon":"/w/images/6/6f/Blue_marker.png"},{"text":"\u003Cp\u003EThe \u003Ca href=\"/wiki/City\" title=\"City\"\u003ECity\u003C/a\u003E \u003Cb\u003E\u003Ca href=\"/wiki/Gent\" title=\"Gent\"\u003EGent\u003C/a\u003E\u003C/b\u003E is located in \u003Ca href=\"/wiki/Belgium\" title=\"Belgium\"\u003EBelgium\u003C/a\u003E.\n\u003C/p\u003E","title":"Gent","link":"","lat":51.053468,"lon":3.73038,"icon":"/w/images/6/6f/Blue_marker.png"},{"text":"\u003Cp\u003EThe \u003Ca href=\"/wiki/City\" title=\"City\"\u003ECity\u003C/a\u003E \u003Cb\u003E\u003Ca href=\"/wiki/Hamburg\" title=\"Hamburg\"\u003EHamburg\u003C/a\u003E\u003C/b\u003E is located in \u003Ca href=\"/wiki/Demo:Germany\" title=\"Demo:Germany\"\u003EGermany\u003C/a\u003E.\n\u003C/p\u003E","title":"Hamburg","link":"","lat":53.5510846,"lon":9.9936818,"icon":"/w/images/6/6f/Blue_marker.png"},{"text":"\u003Cp\u003EThe \u003Ca href=\"/wiki/City\" title=\"City\"\u003ECity\u003C/a\u003E \u003Cb\u003E\u003Ca href=\"/wiki/Khabarovsk\" title=\"Khabarovsk\"\u003EKhabarovsk\u003C/a\u003E\u003C/b\u003E is located in [[{{{2}}}]].\n\u003C/p\u003E","title":"Khabarovsk","link":"","lat":48.485637,"lon":135.0795875,"icon":"/w/images/6/6f/Blue_marker.png"},{"text":"\u003Cp\u003EThe \u003Ca href=\"/wiki/Country\" title=\"Country\"\u003ECountry\u003C/a\u003E \u003Cb\u003E\u003Ca href=\"/wiki/Netherlands\" title=\"Netherlands\"\u003ENetherlands\u003C/a\u003E\u003C/b\u003E is located in \u003Ca href=\"/wiki/Europe\" title=\"Europe\"\u003EEurope\u003C/a\u003E.\n\u003C/p\u003E","title":"Netherlands","link":"","lat":52.160454557747,"lon":5.625,"icon":"/w/images/6/6f/Blue_marker.png"},{"text":"\u003Cp\u003EThe \u003Ca href=\"/wiki/Country\" title=\"Country\"\u003ECountry\u003C/a\u003E \u003Cb\u003E\u003Ca href=\"/wiki/Norway\" title=\"Norway\"\u003ENorway\u003C/a\u003E\u003C/b\u003E is located in \u003Ca href=\"/wiki/Europe\" title=\"Europe\"\u003EEurope\u003C/a\u003E.\n\u003C/p\u003E","title":"Norway","link":"","lat":60.472024,"lon":8.468946,"icon":"/w/images/6/6f/Blue_marker.png"},{"text":"\u003Cp\u003EThe \u003Ca href=\"/wiki/Country\" title=\"Country\"\u003ECountry\u003C/a\u003E \u003Cb\u003E\u003Ca href=\"/wiki/Portugal\" title=\"Portugal\"\u003EPortugal\u003C/a\u003E\u003C/b\u003E is located in [[{{{2}}}]].\n\u003C/p\u003E","title":"Portugal","link":"","lat":39.567870063777,"lon":-8.81103515625,"icon":"/w/images/6/6f/Blue_marker.png"}],"imageLayers":[]}