Maps (MediaWiki extension): Difference between revisions

The educational technology and digital learning wiki
Jump to navigation Jump to search
(Created page with "{{Mediawiki extension |name=Maps |about=This is '''not''' official documentation |developers=Jeroen De Dauw, others |author_location=Gent, Belgium |description=Maps is a Media...")
 
 
(47 intermediate revisions by the same user not shown)
Line 21: Line 21:


Maps is a MediaWiki extension that provides the ability to visualize geographic data with dynamic, JavaScript based, mapping API's such as Google Maps and OpenLayers in your wiki pages. It has built-in support for geocoding, displaying maps, displaying markers, adding pop-ups, and more. Maps allows extensive customization of your maps, either per map, or via a general setting affecting all maps on your wiki. It is used by the Semantic Maps extension. ([http://semantic-mediawiki.org/wiki/Maps Maps], retrieved Aug 2013.
Maps is a MediaWiki extension that provides the ability to visualize geographic data with dynamic, JavaScript based, mapping API's such as Google Maps and OpenLayers in your wiki pages. It has built-in support for geocoding, displaying maps, displaying markers, adding pop-ups, and more. Maps allows extensive customization of your maps, either per map, or via a general setting affecting all maps on your wiki. It is used by the Semantic Maps extension. ([http://semantic-mediawiki.org/wiki/Maps Maps], retrieved Aug 2013.
== Geocoding ==
Geocoding allows to work with addresses instead of coordinates, i.e. geocoding can convert something like <code>40 boulevard du Pont d'Arve, Geneva</code> into coordinates.
Live example:
<source lang="bibtex" enclose="div">{{#geocode:40 bd du Pont-d'Arve, Genève}}</source>
: gives: {{#geocode:40 bd du Pont-d'Arve, Genève}}
<source lang="bibtex" enclose="div">{{#geocode:location=40 bd du Pont-d'Arve, Genève|format=float}}</source>
: gives: {{#geocode:location=40 bd du Pont-d'Arve, Genève|format=float}}
<source lang="bibtex" enclose="div">{{#geocode:location=40 bd du Pont-d'Arve, Genève|format=float|directional=no}}</source>
: gives: {{#geocode:location=40 bd du Pont-d'Arve, Genève|format=float|directional=no}}
See more example in the [http://semantic-mediawiki.org/wiki/Maps/Geocoding official manual]
== Displaying Maps V 3.x ==
In order to display map with one or more markers, you can either enter addresses that will be resolved by a geocoding service (see above) or coordinates.
One either can use a parser function or XML code.
: Parser function:
<source lang="bibtex">{{#display_map:....}}</source>
: XML code:
<source lang="XML"><display_map>...</display_map></source>
Simple syntax example:
<source lang="bibtex" enclose="div">{{#display_map:<your location>|height=<some height>|service=<your service>|zoom=<zoom-level>}}</source>
Read the [http://semantic-mediawiki.org/wiki/Maps/Displaying_maps official documentation], though there are new parameters which are not yet documented.
=== Parameters for #display_map ===
(under construction ....)
As of August 2013, parameters for #display_map (Maps version 3.0) are not yet officially documented, but look at [https://semantic-mediawiki.org/wiki/User:Jeroen_De_Dauw/Describe  Jeroen De Dauw] list.
{| class="wikitable"
|+ Some extra parameters (to be tested...)
! Parameter name and aliases !! explanation || values || Example(s)
|-
| Default (blank) || Define locations for markers || either an address or coordinates. Will figure out automatically what to do || Geneva<br/>40 boulevard du Pont d'Arve, 1205 Genève, Suisse<br/>40.7143528, -74.0059731
|-
| coords or location or address or addresses or locations or points || (not sure about this ...|| ||
|-
| width || Width of the Map || || 400px
|-
| height ||Height of the Map|| || 600px
|-
| center or centre || || ||
|-
! Colspan =4| Services
|-
| geoservice || Identifies the geocoding service || geonames or google ||
|-
| mappingservice or service|| Identifies the mapping service || ||
|-
! Colspan =4| Information and icons
|-
| title  || || ||
|-
| label or text  || || ||
|-
| icon  || || ||
|-
| visitedicon  || || ||
|-
! colspan = 4| Drawings
|-
| lines || ||  ||
|-
| circles || || ||
|-
| polygones || || ||
|-
| rectangles || || ||
|-
| copycoords || || ||
|-
! colspan = 4 | User interface
|-
| wmsoverlay || || ||
|-
| maxzoom || || ||
|-
| minzoom || || ||
|-
| markercluster || || ||
|-
| colspan = 4 | Other
|-
| copycoords || || ||
|-
| static || || ||
|}
=== Simple examples ===
Most basic use example (result not shown):
<source lang="bibtex">{{#display_map:Genève}}</source>
<source lang="bibtex">{{#display_map:Geneva, Switzerland}}</source>
Below are some simple examples using height and width and zoom parameters.
<source lang="bibtex">{{#display_map:Geneva, Switzerland|height=200px|width=400px|zoom=6}}</source>
{{#display_map:Geneva, Switzerland|height=200px|width=400px|zoom=6}}
<source lang="bibtex">{{#display_map:Geneva, Switzerland|width=400px|service=openlayers}}</source>
{{#display_map:Geneva, Switzerland|width=400px|service=openlayers}}
=== More examples ===
See
* [[Maps_(MediaWiki_extension)/Multiple points examples|Multiple points examples]]
* [[Maps_(MediaWiki_extension)/Layers examples|Layers examples]]
== Other Maps parser functions ==
(to be documented)
Coordinates Formats coordinates
Display map Simple map display without markers
Distance Distance conversion
Finddestination Finds the destination given a starting point
Geodistance Calculates the distance between two points
== Installation and configuration ==
=== Installation ===
==== Installation for MW 1.22 or better ====
(since nov 2013)
1) Install composer as explained for example in the [[semantic MediaWiki]] article.
2) Cd to your mediawiki '''base''' installation directory (not the extensions !!)
3) If needed, remove the old extensions/maps directory
4) Type
composer require mediawiki/maps "*"
==== Installation prior to MW 1.22 ====
In order to install a bleeding edge 3.0 alpha version, we did the following in this wiki:
* Upgrade PHP to 5.3.10 (i.e. the default in Ubuntu 12.04)
* Upgrade both the Wiki and all SMW extensions to developer (alpha) code
<source lang=bash>
cd extensions:
git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/DataValues.git
git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/Validator.git
git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/Maps.git
</source>
=== Configuration ===
You can use Maps out of the box. However, some services require API keys and according configuration settings in LocaSettings.php.
; Google Maps JavaScript API keys
: These are needed for some extra functionality like layers
* Read [https://developers.google.com/maps/documentation/javascript/tutorial Getting Started] at Google
: ( more to come ....)
; Using OpenLayers as default geocoding service
In LocalSettings.php
* Sign up at http://api.geonames.org/
* [http://www.geonames.org/manageaccount Enable the account] to use the free web services, i.e. click on the link at the bottom of [http://www.geonames.org/manageaccount that page]
* In the LocalSettings.php file define $egMapsGeoNamesUser (after loading Maps)
: $egMapsGeoNamesUser = YourUserName;
Problem:
: Some addresses don't work as well as with Google (not that sure about this ...)
=== Debugging and troubleshooting ===
; General MediaWiki debugging information
* Read [http://www.mediawiki.org/wiki/How_to_debug_MediaWiki How to debug MediaWiki] at mediawiki.org
; Bad use of parameters and values
Wrap <code><nowiki><listerrors> </listerrors></nowiki></code> around an expression. This will tell [[ParamProcessor]] to display errors
: However, when I tried (15:42, 24 August 2013 (CEST)), I got a blank page.
; Maps stop working without reason (i.e. code wasn't changed)
There are several possibilites
: Probably you exceeded the amount of requests / hour with a geocoding or mapping service you can make.
: You did upgrades. Be careful of dependencies, i.e. either use a stable version or upgrade everything all the time.
: Memory limit exceeded. Check the webserver's error log (/var/log/apache2/error.log for example). You also can use less maps in a single page. This page did encounter memory limit problems and I moved maps to subpages ...
; After editing page, you can't see contents.
: Edit the page :)
== Links ==
* https://semantic-mediawiki.org/wiki/User:Jeroen_De_Dauw/Describe
* https://semantic-mediawiki.org/wiki/User:Jeroen_De_Dauw/Mapsdoc

Latest revision as of 19:35, 30 January 2014

Category:MediaWiki extension
Maps (MediaWiki extension)
Extension name Maps
About this article / disclaimer This is not official documentation
Logo Placeholder.png
Screenshot Placeholder.png
Location of the main author Gent, Belgium
Coordinates of the main authors 51.053829, 3.725012
Developers Jeroen De Dauw, others
Licences
Description Maps is a MediaWiki extension that provides the ability to visualize geographic data with dynamic, JavaScript based, mapping API's. It has built-in support for geocoding, displaying maps, displaying markers, adding pop-ups, and more.
Mediawiki requirements 1.17.* or higher for version 2.0, 1.21 alpha or higher or the 3.0 development version
Dependencies ParamProcessor
Related extensions (documented here) Semantic Maps
Related extensions
Discussion
Language support Many
Status
First release date 2009/07/01
Last release date (as of 2013/08/22!) 2013/08/01
Last version number 2.0.1 (stable, 12/2012), 3.0 (alpha)
Programming language PHP
Alternatives
Website home page
Publications
Support websites web site
Example websites http://semantic-mediawiki.org/wiki/Maps
Last edited 2013/08/22

Introduction

Maps is a MediaWiki extension that provides the ability to visualize geographic data with dynamic, JavaScript based, mapping API's such as Google Maps and OpenLayers in your wiki pages. It has built-in support for geocoding, displaying maps, displaying markers, adding pop-ups, and more. Maps allows extensive customization of your maps, either per map, or via a general setting affecting all maps on your wiki. It is used by the Semantic Maps extension. (Maps, retrieved Aug 2013.

Geocoding

Geocoding allows to work with addresses instead of coordinates, i.e. geocoding can convert something like 40 boulevard du Pont d'Arve, Geneva into coordinates.

Live example:

{{#geocode:40 bd du Pont-d'Arve, Genève}}
gives: 46° 11' 41.42" N, 6° 8' 24.91" E
{{#geocode:location=40 bd du Pont-d'Arve, Genève|format=float}}
gives: 46.194839 N, 6.140253 E
{{#geocode:location=40 bd du Pont-d'Arve, Genève|format=float|directional=no}}
gives: 46.194839, 6.140253

See more example in the official manual

Displaying Maps V 3.x

In order to display map with one or more markers, you can either enter addresses that will be resolved by a geocoding service (see above) or coordinates.

One either can use a parser function or XML code.

Parser function:
{{#display_map:....}}
XML code:
<display_map>...</display_map>

Simple syntax example:

{{#display_map:<your location>|height=<some height>|service=<your service>|zoom=<zoom-level>}}

Read the official documentation, though there are new parameters which are not yet documented.

Parameters for #display_map

(under construction ....)

As of August 2013, parameters for #display_map (Maps version 3.0) are not yet officially documented, but look at Jeroen De Dauw list.

Some extra parameters (to be tested...)
Parameter name and aliases explanation values Example(s)
Default (blank) Define locations for markers either an address or coordinates. Will figure out automatically what to do Geneva
40 boulevard du Pont d'Arve, 1205 Genève, Suisse
40.7143528, -74.0059731
coords or location or address or addresses or locations or points (not sure about this ...
width Width of the Map 400px
height Height of the Map 600px
center or centre
Services
geoservice Identifies the geocoding service geonames or google
mappingservice or service Identifies the mapping service
Information and icons
title
label or text
icon
visitedicon
Drawings
lines
circles
polygones
rectangles
copycoords
User interface
wmsoverlay
maxzoom
minzoom
markercluster
Other
copycoords
static

Simple examples

Most basic use example (result not shown):

{{#display_map:Genève}}
{{#display_map:Geneva, Switzerland}}

Below are some simple examples using height and width and zoom parameters.

{{#display_map:Geneva, Switzerland|height=200px|width=400px|zoom=6}}
Loading map...
{{#display_map:Geneva, Switzerland|width=400px|service=openlayers}}
Loading map...

More examples

See

Other Maps parser functions

(to be documented)

Coordinates 	Formats coordinates 
Display map 	Simple map display without markers 
Distance 	Distance conversion 
Finddestination Finds the destination given a starting point
Geodistance 	Calculates the distance between two points

Installation and configuration

Installation

Installation for MW 1.22 or better

(since nov 2013)

1) Install composer as explained for example in the semantic MediaWiki article.

2) Cd to your mediawiki base installation directory (not the extensions !!)

3) If needed, remove the old extensions/maps directory

4) Type

composer require mediawiki/maps "*"

Installation prior to MW 1.22

In order to install a bleeding edge 3.0 alpha version, we did the following in this wiki:

  • Upgrade PHP to 5.3.10 (i.e. the default in Ubuntu 12.04)
  • Upgrade both the Wiki and all SMW extensions to developer (alpha) code
cd extensions:
git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/DataValues.git
git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/Validator.git
git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/Maps.git

Configuration

You can use Maps out of the box. However, some services require API keys and according configuration settings in LocaSettings.php.

Google Maps JavaScript API keys
These are needed for some extra functionality like layers
( more to come ....)


Using OpenLayers as default geocoding service

In LocalSettings.php

$egMapsGeoNamesUser = YourUserName;

Problem:

Some addresses don't work as well as with Google (not that sure about this ...)

Debugging and troubleshooting

General MediaWiki debugging information


Bad use of parameters and values

Wrap <listerrors> </listerrors> around an expression. This will tell ParamProcessor to display errors

However, when I tried (15:42, 24 August 2013 (CEST)), I got a blank page.


Maps stop working without reason (i.e. code wasn't changed)

There are several possibilites

Probably you exceeded the amount of requests / hour with a geocoding or mapping service you can make.
You did upgrades. Be careful of dependencies, i.e. either use a stable version or upgrade everything all the time.
Memory limit exceeded. Check the webserver's error log (/var/log/apache2/error.log for example). You also can use less maps in a single page. This page did encounter memory limit problems and I moved maps to subpages ...


After editing page, you can't see contents.
Edit the page :)

Links