Working With MediaWiki
abandoned the service.) More mapping services may eventually get added.
Google Maps probably needs no explanation — it’s the dominant mapping service on the web, and rightly so, since it’s extremely well done. (We are talking here about the Google Maps service, not the Google Maps website located at maps.google.com.)
OpenLayersis interesting, because it’s an open-source, generic framework for displaying any mapping data — in theory, even Google Maps can be displayed within OpenLayers. Usually, though, when OpenLayers is used, it’s used to display mapping data from OpenStreetMap. OpenStreetMap is a very exciting mapping service, which is completely open-source, and is generated collaboratively by users via a wiki interface (not MediaWiki — it uses its own custom software). Google Maps is free to most users, but with exceptions — non-public websites need to pay to use it, as do public websites that make massive use of it (the exact amount of traffic before Google requires payment seems to be in flux at the moment). For those cases, and others, the combination of OpenLayers and OpenStreetMap is an increasingly viable alternative.
This book, by necessity, skips over a lot of smaller details, and that’s certainly true of the sections about the Maps and Semantic Maps extensions — these two extensions have a variety of parameters and administrative settings that won’t be mentioned here. To see a complete overview (and a lot of interesting demos), please go to the extension homepages:
https://www.mediawiki.org/wiki/Extension:Maps
https://www.mediawiki.org/wiki/Extension:Semantic_Maps
The Maps extension
Maps allows for the display of maps, with or without points on them, in various, non-semantic ways. Maps defines six main functions, each of which are available as both a parser function and a tag function. One does the actual display of maps: display_map. The other five are utility functions, which do a variety of tasks related to coordinates: coordinates, distance, finddestination, geocode, and geodistance.
Let’s go over display_map first. Like all the others, it can be called as either #display_map or . It can take the following parameters:
points=
, or an unnamed parameter — the set of points to be displayed, separated by semicolons, taking the form of either addresses or coordinates. There is an entire syntax for these points (see below).
center=
(or
centre=
) — sets the center of the map. This can take in either coordinates or an actual address.
service=
— sets the mapping service to be used; the current possible options are
googlemaps
,
openlayers
and
osm
(for the combination of OpenLayers and OpenStreetMap).
geoservice=
— sets the geocoding service to be used, if any geocoding is to be done; the current possible options are
geonames
and
google
.
width=
— sets the width of the map — can be in “px”, “em” or a percentage (if no unit is specified, pixels are assumed). The default is “100%”.
height=
— sets the height of the map; works like the
width
parameter. The default is 350 pixels.
zoom=
— sets the zoom level of the map. This is an integer, whose range of settings depends on the mapping service being used.
icon=
— an image to show for all markers (this, like most parameters, is optional).
lines=
— sets the group of points between which to draw lines, with groups separated by semicolons, and then points within groups separated by colons.
polygons=
— same syntax as the “lines” parameter, but sets filled-in polygons.
The syntax for defining the parameter for the points, which can either be unnamed or named as
points=
, depends on whether “display_map” is called as a parser function or a tag. In both cases, if you simply want to display one point (the most common usage), and don’t want any specific formatting, this value can just be coordinates (like “43.9° N, 103.5° W”), or an address or descriptor (like “Eiffel Tower”). If you want to show more than one point, or have extra formatting, the full syntax is as follows:
For #display_map:
point 1~title 1~caption 1~marker 1;point 2~title 2~caption 2~marker 2
For :
point 1|title 1|caption 1|marker 1
point 2|title 2|caption 2|marker 2
Here’s an example of a call to :
Nairobi National Park|Nairobi National Park|Kenya’s first national park.|Green marker.png
And the equivalent call to
Weitere Kostenlose Bücher