|
|
Line 1: |
Line 1: |
| As parts of its [[Semantic MediaWiki|integration with Semantic MediaWiki]], Maps adds several mapping result formats. These formats all support the <code>template</code> parameter, which can be used to customize the information shown when clicking a marker or shape.
| | This page is about customization of the information that is shown when clicking a marker or shape on a [[Semantic MediaWiki|map showing the result of a Semantic MediaWiki query]]. |
|
| |
|
| == Default display without template == | | == Default behavior == |
|
| |
|
| By default, the information shown | | By default the name of the page is shown. If addition properties are queried, they are shown in a list below the title. |
|
| |
|
| <pre> | | <pre> |
Line 24: |
Line 24: |
| }} | | }} |
|
| |
|
| == Using a template == | | == Parameters == |
| | |
| | Parameters relevant for customization: |
| | |
| | * <code>template</code> |
| | * <code>showtitle</code> |
| | * <code>hidenamespace</code> |
| | * <code>userparam</code> |
| | |
| | For a full list of parameters you can use in the map formats, see [[Leaflet SMW queries]] and [[Google Maps SMW queries]]. |
| | |
| | == Templates == |
| | |
| | Templates allow you to fully customize what gets shown in the popups. |
| | |
| | Templates are specified with the <code>template</code> parameter, which takes the name of a template on your wiki. The <code>showtitle</code> parameter is often useful here, as setting it to <code>no</code> allows you to have full control over the popup content. |
|
| |
|
| This example shows usage of multiple queried values via the [[Template:City Popup|"City Popup" template]]. | | This example shows usage of multiple queried values via the [[Template:City Popup|"City Popup" template]]. |
Line 50: |
Line 65: |
| | scrollzoom=off | | | scrollzoom=off |
| }} | | }} |
| | |
| | Template content: <code>The city '''[[{{{title}}}]]''' is located in [[{{{Located in}}}]]. It has a population of {{{Population}}} and surface area of {{{Surface area}}} km²</code> |
This page is about customization of the information that is shown when clicking a marker or shape on a map showing the result of a Semantic MediaWiki query.
Default behavior
By default the name of the page is shown. If addition properties are queried, they are shown in a list below the title.
{{#ask:[[Category:Cities]]
| format=map
| ?Coordinates
| ?Located in
| ?Population
| ?Surface area
}}
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":false,"cluster":false,"clustermaxzoom":20,"clusterzoomonclick":true,"clustermaxradius":80,"clusterspiderfy":true,"geojson":"","clicktarget":"","showtitle":true,"hidenamespace":true,"template":"","userparam":"","activeicon":"","pagelabel":false,"ajaxcoordproperty":"","ajaxquery":"","locations":[{"text":"\u003Cb\u003E\u003Ca href=\"/wiki/Example_data:Amsterdam\" title=\"Example data:Amsterdam\"\u003EAmsterdam\u003C/a\u003E\u003C/b\u003E\u003Chr /\u003E\u003Ca href=\"/wiki/Property:Located_in\" title=\"Property:Located in\"\u003ELocated in\u003C/a\u003E: \u003Ca href=\"/w/index.php?title=Netherlands\u0026amp;action=edit\u0026amp;redlink=1\" class=\"new\" title=\"Netherlands (page does not exist)\"\u003ENetherlands\u003C/a\u003E\u003Cbr /\u003E\u003Ca href=\"/wiki/Property:Population\" title=\"Property:Population\"\u003EPopulation\u003C/a\u003E: 872,680\u003Cbr /\u003E\u003Ca href=\"/wiki/Property:Surface_area\" title=\"Property:Surface area\"\u003ESurface area\u003C/a\u003E: 219.32","title":"Amsterdam","link":"","lat":52.372761111111,"lon":4.8936027777778,"icon":""},{"text":"\u003Cb\u003E\u003Ca href=\"/wiki/Example_data:Berlin\" title=\"Example data:Berlin\"\u003EBerlin\u003C/a\u003E\u003C/b\u003E\u003Chr /\u003E\u003Ca href=\"/wiki/Property:Located_in\" title=\"Property:Located in\"\u003ELocated in\u003C/a\u003E: \u003Ca href=\"/w/index.php?title=Germany\u0026amp;action=edit\u0026amp;redlink=1\" class=\"new\" title=\"Germany (page does not exist)\"\u003EGermany\u003C/a\u003E\u003Cbr /\u003E\u003Ca href=\"/wiki/Property:Population\" title=\"Property:Population\"\u003EPopulation\u003C/a\u003E: 3,769,495\u003Cbr /\u003E\u003Ca href=\"/wiki/Property:Surface_area\" title=\"Property:Surface area\"\u003ESurface area\u003C/a\u003E: 891.1","title":"Berlin","link":"","lat":52.517036111111,"lon":13.388861111111,"icon":""},{"text":"\u003Cb\u003E\u003Ca href=\"/wiki/Example_data:Brussels\" title=\"Example data:Brussels\"\u003EBrussels\u003C/a\u003E\u003C/b\u003E\u003Chr /\u003E\u003Ca href=\"/wiki/Property:Located_in\" title=\"Property:Located in\"\u003ELocated in\u003C/a\u003E: \u003Ca href=\"/w/index.php?title=Belgium\u0026amp;action=edit\u0026amp;redlink=1\" class=\"new\" title=\"Belgium (page does not exist)\"\u003EBelgium\u003C/a\u003E\u003Cbr /\u003E\u003Ca href=\"/wiki/Property:Population\" title=\"Property:Population\"\u003EPopulation\u003C/a\u003E: 1,208,542\u003Cbr /\u003E\u003Ca href=\"/wiki/Property:Surface_area\" title=\"Property:Surface area\"\u003ESurface area\u003C/a\u003E: 162.4","title":"Brussels","link":"","lat":50.846558333333,"lon":4.3516972222222,"icon":""},{"text":"\u003Cb\u003E\u003Ca href=\"/wiki/Example_data:Ghent\" title=\"Example data:Ghent\"\u003EGhent\u003C/a\u003E\u003C/b\u003E\u003Chr /\u003E\u003Ca href=\"/wiki/Property:Located_in\" title=\"Property:Located in\"\u003ELocated in\u003C/a\u003E: \u003Ca href=\"/w/index.php?title=Belgium\u0026amp;action=edit\u0026amp;redlink=1\" class=\"new\" title=\"Belgium (page does not exist)\"\u003EBelgium\u003C/a\u003E\u003Cbr /\u003E\u003Ca href=\"/wiki/Property:Population\" title=\"Property:Population\"\u003EPopulation\u003C/a\u003E: 260,341\u003Cbr /\u003E\u003Ca href=\"/wiki/Property:Surface_area\" title=\"Property:Surface area\"\u003ESurface area\u003C/a\u003E: 156.18","title":"Ghent","link":"","lat":51.053827777778,"lon":3.7250111111111,"icon":""},{"text":"\u003Cb\u003E\u003Ca href=\"/wiki/Example_data:Hamburg\" title=\"Example data:Hamburg\"\u003EHamburg\u003C/a\u003E\u003C/b\u003E\u003Chr /\u003E\u003Ca href=\"/wiki/Property:Located_in\" title=\"Property:Located in\"\u003ELocated in\u003C/a\u003E: \u003Ca href=\"/w/index.php?title=Germany\u0026amp;action=edit\u0026amp;redlink=1\" class=\"new\" title=\"Germany (page does not exist)\"\u003EGermany\u003C/a\u003E\u003Cbr /\u003E\u003Ca href=\"/wiki/Property:Population\" title=\"Property:Population\"\u003EPopulation\u003C/a\u003E: 1,822,445\u003Cbr /\u003E\u003Ca href=\"/wiki/Property:Surface_area\" title=\"Property:Surface area\"\u003ESurface area\u003C/a\u003E: 755.22","title":"Hamburg","link":"","lat":53.543763888889,"lon":10.009913888889,"icon":""},{"text":"\u003Cb\u003E\u003Ca href=\"/wiki/Example_data:Hannover\" title=\"Example data:Hannover\"\u003EHannover\u003C/a\u003E\u003C/b\u003E\u003Chr /\u003E\u003Ca href=\"/wiki/Property:Located_in\" title=\"Property:Located in\"\u003ELocated in\u003C/a\u003E: \u003Ca href=\"/w/index.php?title=Germany\u0026amp;action=edit\u0026amp;redlink=1\" class=\"new\" title=\"Germany (page does not exist)\"\u003EGermany\u003C/a\u003E\u003Cbr /\u003E\u003Ca href=\"/wiki/Property:Population\" title=\"Property:Population\"\u003EPopulation\u003C/a\u003E: 538,068\u003Cbr /\u003E\u003Ca href=\"/wiki/Property:Surface_area\" title=\"Property:Surface area\"\u003ESurface area\u003C/a\u003E: 204.01","title":"Hannover","link":"","lat":52.374477777778,"lon":9.7385527777778,"icon":""},{"text":"\u003Cb\u003E\u003Ca href=\"/wiki/Example_data:London\" title=\"Example data:London\"\u003ELondon\u003C/a\u003E\u003C/b\u003E\u003Chr /\u003E\u003Ca href=\"/wiki/Property:Located_in\" title=\"Property:Located in\"\u003ELocated in\u003C/a\u003E: \u003Ca href=\"/w/index.php?title=United_Kingdom\u0026amp;action=edit\u0026amp;redlink=1\" class=\"new\" title=\"United Kingdom (page does not exist)\"\u003EUnited Kingdom\u003C/a\u003E\u003Cbr /\u003E\u003Ca href=\"/wiki/Property:Population\" title=\"Property:Population\"\u003EPopulation\u003C/a\u003E: 9,787,426\u003Cbr /\u003E\u003Ca href=\"/wiki/Property:Surface_area\" title=\"Property:Surface area\"\u003ESurface area\u003C/a\u003E: 607","title":"London","link":"","lat":51.507322222222,"lon":-0.12764722222222,"icon":""}],"imageLayers":[]}
Parameters
Parameters relevant for customization:
template
showtitle
hidenamespace
userparam
For a full list of parameters you can use in the map formats, see Leaflet SMW queries and Google Maps SMW queries.
Templates
Templates allow you to fully customize what gets shown in the popups.
Templates are specified with the template
parameter, which takes the name of a template on your wiki. The showtitle
parameter is often useful here, as setting it to no
allows you to have full control over the popup content.
This example shows usage of multiple queried values via the "City Popup" template.
{{#ask:[[Category:Cities]]
| format=map
| ?Coordinates
| ?Located in
| ?Population
| ?Surface area
| template=City Popup
| showtitle=off
}}
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":false,"cluster":false,"clustermaxzoom":20,"clusterzoomonclick":true,"clustermaxradius":80,"clusterspiderfy":true,"geojson":"","clicktarget":"","showtitle":false,"hidenamespace":true,"template":"City Popup","userparam":"","activeicon":"","pagelabel":false,"ajaxcoordproperty":"","ajaxquery":"","locations":[{"text":"\u003Cp\u003EThe city \u003Cb\u003E\u003Ca href=\"/wiki/Example_data:Amsterdam\" title=\"Example data:Amsterdam\"\u003EAmsterdam\u003C/a\u003E\u003C/b\u003E is located in \u003Ca href=\"/w/index.php?title=Netherlands\u0026amp;action=edit\u0026amp;redlink=1\" class=\"new\" title=\"Netherlands (page does not exist)\"\u003ENetherlands\u003C/a\u003E.\n\u003C/p\u003E\u003Cp\u003EIt has a population of 872,680 and surface area of 219.32 km\u00b2\n\u003C/p\u003E","title":"Amsterdam","link":"","lat":52.372761111111,"lon":4.8936027777778,"icon":""},{"text":"\u003Cp\u003EThe city \u003Cb\u003E\u003Ca href=\"/wiki/Example_data:Berlin\" title=\"Example data:Berlin\"\u003EBerlin\u003C/a\u003E\u003C/b\u003E is located in \u003Ca href=\"/w/index.php?title=Germany\u0026amp;action=edit\u0026amp;redlink=1\" class=\"new\" title=\"Germany (page does not exist)\"\u003EGermany\u003C/a\u003E.\n\u003C/p\u003E\u003Cp\u003EIt has a population of 3,769,495 and surface area of 891.1 km\u00b2\n\u003C/p\u003E","title":"Berlin","link":"","lat":52.517036111111,"lon":13.388861111111,"icon":""},{"text":"\u003Cp\u003EThe city \u003Cb\u003E\u003Ca href=\"/wiki/Example_data:Brussels\" title=\"Example data:Brussels\"\u003EBrussels\u003C/a\u003E\u003C/b\u003E is located in \u003Ca href=\"/w/index.php?title=Belgium\u0026amp;action=edit\u0026amp;redlink=1\" class=\"new\" title=\"Belgium (page does not exist)\"\u003EBelgium\u003C/a\u003E.\n\u003C/p\u003E\u003Cp\u003EIt has a population of 1,208,542 and surface area of 162.4 km\u00b2\n\u003C/p\u003E","title":"Brussels","link":"","lat":50.846558333333,"lon":4.3516972222222,"icon":""},{"text":"\u003Cp\u003EThe city \u003Cb\u003E\u003Ca href=\"/wiki/Example_data:Ghent\" title=\"Example data:Ghent\"\u003EGhent\u003C/a\u003E\u003C/b\u003E is located in \u003Ca href=\"/w/index.php?title=Belgium\u0026amp;action=edit\u0026amp;redlink=1\" class=\"new\" title=\"Belgium (page does not exist)\"\u003EBelgium\u003C/a\u003E.\n\u003C/p\u003E\u003Cp\u003EIt has a population of 260,341 and surface area of 156.18 km\u00b2\n\u003C/p\u003E","title":"Ghent","link":"","lat":51.053827777778,"lon":3.7250111111111,"icon":""},{"text":"\u003Cp\u003EThe city \u003Cb\u003E\u003Ca href=\"/wiki/Example_data:Hamburg\" title=\"Example data:Hamburg\"\u003EHamburg\u003C/a\u003E\u003C/b\u003E is located in \u003Ca href=\"/w/index.php?title=Germany\u0026amp;action=edit\u0026amp;redlink=1\" class=\"new\" title=\"Germany (page does not exist)\"\u003EGermany\u003C/a\u003E.\n\u003C/p\u003E\u003Cp\u003EIt has a population of 1,822,445 and surface area of 755.22 km\u00b2\n\u003C/p\u003E","title":"Hamburg","link":"","lat":53.543763888889,"lon":10.009913888889,"icon":""},{"text":"\u003Cp\u003EThe city \u003Cb\u003E\u003Ca href=\"/wiki/Example_data:Hannover\" title=\"Example data:Hannover\"\u003EHannover\u003C/a\u003E\u003C/b\u003E is located in \u003Ca href=\"/w/index.php?title=Germany\u0026amp;action=edit\u0026amp;redlink=1\" class=\"new\" title=\"Germany (page does not exist)\"\u003EGermany\u003C/a\u003E.\n\u003C/p\u003E\u003Cp\u003EIt has a population of 538,068 and surface area of 204.01 km\u00b2\n\u003C/p\u003E","title":"Hannover","link":"","lat":52.374477777778,"lon":9.7385527777778,"icon":""},{"text":"\u003Cp\u003EThe city \u003Cb\u003E\u003Ca href=\"/wiki/Example_data:London\" title=\"Example data:London\"\u003ELondon\u003C/a\u003E\u003C/b\u003E is located in \u003Ca href=\"/w/index.php?title=United_Kingdom\u0026amp;action=edit\u0026amp;redlink=1\" class=\"new\" title=\"United Kingdom (page does not exist)\"\u003EUnited Kingdom\u003C/a\u003E.\n\u003C/p\u003E\u003Cp\u003EIt has a population of 9,787,426 and surface area of 607 km\u00b2\n\u003C/p\u003E","title":"London","link":"","lat":51.507322222222,"lon":-0.12764722222222,"icon":""}],"imageLayers":[]}
Template content: The city [[{{{title}}}]] is located in [[{{{Located in}}}]]. It has a population of {{{Population}}} and surface area of {{{Surface area}}} km²