Extension:Maps/Displaying maps

From semantic-mediawiki.org
Jump to: navigation, search
MapsExtension:Maps/Displaying maps

Displaying Maps

Displaying maps is done with the #display_map parser function.

{{#display_map:Brandenburg Gate, Berlin, Germany}}

You can display multiple locations by separating them with semicolons. And it is possible to use coordinates instead of location names.

{{#display_map:Berlin; Brussel; 40° 42' 46.02" N, 74° 0' 21.39" W}}

The maps can be customized with a good number of parameters. Most notably the service parameter, which allows you to specify the mapping service to use.

{{#display_map:Berlin|width=400|height=300|service=leaflet}}

The available parameters depend on the mapping service you pick.

Base parameters

There parameters are available for all mapping services.

Shown on the map

  • locations: The locations you want to display, separated by semicolon. This is the main parameter of #display_map and is normally not named explicitly.
  • lines: The lines to display, separated by semicolon.
  • polygons: The polygons to display, separated by semicolon.
  • circles: The circles to display, separated by semicolon.
  • rectangles: The rectangles to display, separated by semicolon.
  • wmsoverlay: The wmsoverlays to display, separated by semicolon.

Element meta data

For all map elements (locations, lines, polygons, etc), you need to specify one or more locations. These can be a coordinate in any of the supported formats or human readable location name. You can also specify additional information for the element using unnamed sub-parameters separated using a tilde (~).

  • locations: New York~Popup title~Popup text~File:CustomIcon~Group~Inline label
  • lines: New York:Berlin:42.1337,23.9001:London~Popup title~Popup text~Stroke color~Opacity~Stroke weight
  • polygons:
  • circles:
  • rectangles:
  • wmsoverlay:

To quickly construct the wikitext for your map elements, or to create examples for yourself, you can use the MapEditor Special Page.

Map properties

  • service: The mapping service to use. Can be leaflet, googlemaps or openlayers. Defaults to leaflet, which can be changed in your wikis configuration.
  • width: Width of the map in pixels or another supported unit. Supported units are px, ex, em and %. Also allows "auto". Default is "auto", which can be changed in your wikis configuration.
  • height: Height of the map in pixels or another supported unit. Supported units are px, ex, em and %. Default is "350", which can be changed in your wikis configuration.
  • center: On which location the map should center. This can be a coordinate or human readable location. Defaults to the locations you provided, if any.
  • title: Default title to show in popups
  • label: Default label to show in popups
  • icon: Default icon to use for markers
  • maxzoom: Whole number indicating what the maximum zoom level is
  • minzoom: Whole number indicating what the minimum zoom level is.
  • copycoords: If the coordinates of markers should be copyable. Can be yes and no (default).
  • static: If the map should be a static image instead of dynamic and interactive. Can be yes and no (default).

Service specific parameters

Leaflet

Parameter Type Default Description
zoom whole number no The zoom level for the map. For maps with markers this will default to the most zoomed in level that still shows all markers.
defzoom whole number 14 Allows setting the default zoom level of the map.
layers list of texts OpenStreetMap The layers that will be available in the layer selector. The first layer will be shown when the map loads.
overlaylayers list of texts empty The overlay layers that will be shown when the map loads.
resizable yes/no no Makes the map resizable by dragging at its lower right corner.
enablefullscreen yes/no no Enable fullscreen button
markercluster yes/no no Allows merging of multiple nearby markers into one marker
clustermaxzoom whole number 20 The maximum zoom level where clusters may exist.
clusterzoomonclick yes/no yes Whether the default behaviour of clicking on a cluster is to zoom into it.
clustermaxradius whole number 80 The maximum radius that a cluster will cover.
clusterspiderfy yes/no yes When you click a cluster at the bottom zoom level we spiderfy it so you can see all of its markers.

Google Maps

Parameter Type Default Description
zoom whole number 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 text roadmap The map type to initially show.
types list of texts roadmap, satellite, hybrid, terrain The map types that will be available via the type control.
layers list of texts empty Special layers to load onto the map.
controls list of texts pan, zoom, type, scale, streetview The controls to place on the map.
zoomstyle text default The style of the zoom control.
typestyle text default The style of the type control.
autoinfowindows yes/no no Automatically open all info windows after the page has loaded.
resizable yes/no no Makes the map resizable by dragging at its lower right corner.
kmlrezoom yes/no no Rezoom the map after the KML layers have been loaded.
poi yes/no yes Show points of interest.
markercluster yes/no no Allows merging of multiple nearby markers into one marker
clustergridsize whole number 60 The grid size of a cluster in pixels.
clustermaxzoom whole number 20 The maximum zoom level where clusters may exist.
clusterzoomonclick yes/no yes Whether the default behaviour of clicking on a cluster is to zoom into it.
clusteraveragecenter yes/no yes Whether the center of each cluster should be the average of all markers in the cluster.
clusterminsize whole number 2 The minimum number of markers to be in a cluster before the markers are hidden and a count is shown.
tilt whole number 0 Tilt for the Map when using Google Maps.
imageoverlays List of image overlays empty Allows adding an image to be shown on the specified location on the map.
kml list of texts empty KML files to load onto the map.
gkml list of texts empty KML files hosted by Google to load onto the map.
fusiontables list of texts empty IDs of Google Fusion Tables which should be loaded onto the map.
searchmarkers text empty Allows to search for specific markers via a field embedded into the map.
enablefullscreen yes/no no Enable fullscreen button

OpenLayers

Parameter Type Default Description
zoom whole number 13 The zoom level for the map. For maps with markers this will default to the most zoomed in level that still shows all markers.
controls list of texts layerswitcher, mouseposition, autopanzoom, scaleline, navigation The controls to place on the map.
layers list of texts osm-mapnik, osm-cyclemap The layers that will be available in the layer selector. The first layer will be shown when the map loads.
resizable yes/no no Makes the map resizable by dragging at its lower right corner.
overlays text empty Overlay layers that will be available in the layer selector. These layers will be displayed on top of a normal layer, kind of like a marker.
searchmarkers text empty Allows to search for specific markers via a field embedded into the map.
kml list of texts empty KML files to load onto the map.