Google Maps SMW queries
From Maps for MediaWiki
Maps adds a Google Maps result format as part of its integration with Semantic MediaWiki. This result format can be used to visualize queried data onto a map.
Syntax
Maps shown with the Google Maps result format can be customized using various parameters. This example demonstrates a query for coordinates stored on page Example data:Berlin coordinates and usage of the kml parameter:
{{#ask: [[Coordinates::+]] [[Example data:Berlin coordinates]]
| format=googlemaps
| kml=BerlinDistricts.kml
| ?Coordinates
| zoom=9
}}
- Result
Parameters
| ⧼validator-describe-header-parameter⧽ | ⧼validator-describe-header-aliases⧽ | ⧼validator-describe-header-type⧽ | ⧼validator-describe-header-default⧽ | ⧼validator-describe-header-description⧽ |
|---|---|---|---|---|
| width | - | ⧼validator-type-dimension⧽ | auto | Allows setting the width of the map. By default pixels will be assumed as unit, but you can explicitly specify one of these units: px, ex, em, %. |
| height | - | ⧼validator-type-dimension⧽ | 350 | Allows setting the height of the map. By default pixels will be assumed as unit, but you can explicitly specify one of these units: px, ex, em. |
| centre | center | ⧼validator-type-string⧽ | no | The location on which the map should be centered |
| title | - | ⧼validator-type-string⧽ | ⧼validator-describe-empty⧽ | Allows setting text that will be displayed in the pop-ups of all markers that do not have a specific title.
When used together with label, the title will be bold and underlined. |
| label | text | ⧼validator-type-string⧽ | ⧼validator-describe-empty⧽ | Allows setting text that will be displayed in the pop-ups of all markers that do not have a specific label. |
| icon | - | ⧼validator-type-string⧽ | ⧼validator-describe-empty⧽ | Allows setting the icon used for all markers. |
| lines | - | ⧼validator-type-mapsline-list⧽ | ⧼validator-describe-empty⧽ | Lines to display |
| polygons | - | ⧼validator-type-mapspolygon-list⧽ | ⧼validator-describe-empty⧽ | Polygons to display |
| circles | - | ⧼validator-type-mapscircle-list⧽ | ⧼validator-describe-empty⧽ | Circles to display |
| rectangles | - | ⧼validator-type-mapsrectangle-list⧽ | ⧼validator-describe-empty⧽ | Rectangles to display |
| maxzoom | - | ⧼validator-type-integer⧽ | no | The maximum zoom level |
| minzoom | - | ⧼validator-type-integer⧽ | no | The minimum zoom level |
| copycoords | - | ⧼validator-type-boolean⧽ | no | Show a dialog when clicking on a marker from which its coordinates may be copied |
| static | - | ⧼validator-type-boolean⧽ | no | Make the map static |
| visitedicon | - | ⧼validator-type-string⧽ | ⧼validator-describe-empty⧽ | The filename of an image to be used for marker icons after the original markers have been clicked |
| wmsoverlay | - | ⧼validator-type-wmsoverlay⧽ | no | Use a WMS overlay |
| zoom | - | ⧼validator-type-integer⧽ | 14 | The zoom level for the map. For maps with markers this will default to the most zoomed in level that still shows all markers. |
| type | - | ⧼validator-type-string⧽ | roadmap | The map type to initially show. |
| types | - | ⧼validator-type-string-list⧽ | roadmap, satellite, hybrid, terrain | The map types that will be available via the type control. |
| layers | - | ⧼validator-type-string-list⧽ | ⧼validator-describe-empty⧽ | Special layers to load onto the map. |
| controls | - | ⧼validator-type-string-list⧽ | pan, zoom, type, scale, streetview, rotate | The controls to place on the map. |
| zoomstyle | - | ⧼validator-type-string⧽ | default | The style of the zoom control. |
| typestyle | - | ⧼validator-type-string⧽ | default | The style of the type control. |
| autoinfowindows | - | ⧼validator-type-boolean⧽ | no | Automatically open all info windows after the page has loaded. |
| resizable | - | ⧼validator-type-boolean⧽ | no | Makes the map resizable by dragging at its lower right corner. |
| kmlrezoom | - | ⧼validator-type-boolean⧽ | no | Rezoom the map after the KML layers have been loaded. |
| poi | - | ⧼validator-type-boolean⧽ | yes | Show points of interest. |
| cluster | markercluster | ⧼validator-type-boolean⧽ | no | Allows merging of multiple nearby markers into one marker |
| clustergridsize | - | ⧼validator-type-integer⧽ | 60 | The grid size of a cluster in pixels. |
| clustermaxzoom | - | ⧼validator-type-integer⧽ | 20 | The maximum zoom level where clusters may exist. |
| clusterzoomonclick | - | ⧼validator-type-boolean⧽ | yes | Whether the default behaviour of clicking on a cluster is to zoom into it. |
| clusteraveragecenter | - | ⧼validator-type-boolean⧽ | yes | Whether the center of each cluster should be the average of all markers in the cluster. |
| clusterminsize | - | ⧼validator-type-integer⧽ | 2 | The minimum number of markers to be in a cluster before the markers are hidden and a count is shown. |
| imageoverlays | - | ⧼validator-type-mapsimageoverlay-list⧽ | ⧼validator-describe-empty⧽ | Allows adding an image to be shown on the specified location on the map. |
| kml | - | ⧼validator-type-string-list⧽ | ⧼validator-describe-empty⧽ | KML files to load onto the map. |
| gkml | - | ⧼validator-type-string-list⧽ | ⧼validator-describe-empty⧽ | KML files hosted by Google to load onto the map. |
| searchmarkers | - | ⧼validator-type-string⧽ | ⧼validator-describe-empty⧽ | Allows to search for specific markers via a field embedded into the map. |
| fullscreen | enablefullscreen | ⧼validator-type-boolean⧽ | no | Enable fullscreen button |
| mylocation | - | ⧼validator-type-boolean⧽ | no | Enable the geolocation button |
| mylocationfollow | - | ⧼validator-type-boolean⧽ | no | Continously center map on user location |
| mylocationzoom | - | ⧼validator-type-integer⧽ | ||
| The zoom level to go to when user location is turned on | ||||
| scrollwheelzoom | scrollzoom | ⧼validator-type-boolean⧽ | no | Indicates if mouse scrolling should be enabled or not. |
| staticlocations | locations, points | ⧼validator-type-mapslocation-list⧽ | ⧼validator-describe-empty⧽ | A list of locations to add to the map together with the queried data. Like with display_points, you can add a title, description and icon per location using the tilde "~" as separator. |
| showtitle | show title | ⧼validator-type-boolean⧽ | yes | Show a title in the marker info window or not. Disabling this is often useful when using a template to format the info window content. |
| hidenamespace | hide namespace | ⧼validator-type-boolean⧽ | yes | Show the namespace title in the marker info window |
| template | - | ⧼validator-type-string⧽ | no | A template to use to format the info window contents. |
| userparam | - | ⧼validator-type-string⧽ | ⧼validator-describe-empty⧽ | A value passed into each template call, if a template is used |
| activeicon | - | ⧼validator-type-string⧽ | ⧼validator-describe-empty⧽ | Icon to be displayed instead of default marker, when active page is equal to query result |
| pagelabel | - | ⧼validator-type-boolean⧽ | no | When set to "yes", all markers will have an "inlineLabel" with a link to the page containing the coordinates for the marker |
| ajaxcoordproperty | - | ⧼validator-type-string⧽ | ⧼validator-describe-empty⧽ | Name of the coordinate property which is used to build the ajax query. |
| ajaxquery | - | ⧼validator-type-string⧽ | ⧼validator-describe-empty⧽ | A second query that is sent via ajax to fetch additional coordinates. |
Parameter examples
Marker clustering
{{#ask: [[Category:Cities]]
| format=googlemaps
| ?Coordinates
| cluster=on
| zoom=4
}}
Template (simple)
Adding a link to maps.google.com by using a template. See template "Google Maps Link".
{{#ask: [[Category:Cities]]
| format=googlemaps
| ?Coordinates
| template=Google Maps Link
}}
Template (advanced)
This example shows usage of multiple queried values via the "City Popup" template.
{{#ask:[[Category:Cities]]
| format=googlemaps
| ?Coordinates
| ?Located in
| ?Population
| ?Surface area
| template=City Popup
| showtitle=off
}}