Extension:Maps

Maps is an extension that provides the ability to display coordinate data, using multiple mapping services, including Google Maps, OpenLayers and Yahoo Maps, and allows users to geocode addresses. It can be used together with Semantic Maps, which adds semantic capabilities to the mapping services, but can also be used without it on non-semantic wiki's. Both Maps and Semantic Maps are based on Semantic Google Maps and Semantic Layers, and are meant to replace those extensions. Maps contains all functionality of Google Geocoder, and so also replaces this extension. Examples of how to use Maps can be found here.

Downloads

 * Maps0.2.zip 281.03 KB
 * Maps0.2.7z 188.08 KB

You can find older version in the legacy downloads section of the legacy page.

You can also download the code directly via SVN from the MediaWiki source code repository, at http://svn.wikimedia.org/svnroot/mediawiki/trunk/extensions/Maps/. From a command line, you can call the following:

svn checkout http://svn.wikimedia.org/svnroot/mediawiki/tags/extensions/Maps/REL_0_2_2/

Package downloads
Maps and Semantic Maps


 * MapsAndSemanticMaps0.2.zip 307.28 KB
 * MapsAndSemanticMaps0.2.7z 198.3 KB

Semantic Bundle

Semantic Bundle currently includes Maps and Semantic Maps 0.2, as well as some other very interesting Semantic MediaWiki related extensions. Get it here.

Installation instructions
Once you have downloaded the code, place the 'Maps' directory within your MediaWiki 'extensions' directory. Then add the following code to your LocalSettings.php file after the line that installs Semantic MediaWiki:

For using Google Maps or Yahoo! Maps, you must enter their API keys. You need to add them in LocalSettings.php, after the inclusion of Maps.

If you don't already have them, you can obtain them at the Google Maps API page and Yahoo Maps API page. Note that the Google Maps API key is required for both displaying maps AND for geocoding (and therefore also required when you use display_address with a Yahoo! Map). Also note that use of the Google Maps API is free only if your site is accessible to the public; otherwise it costs money - read the Google Maps terms of service for further details.

Once you have successfully installed Maps, you can add a link to your site to the Who is using maps? section.

Server configuration
Here you have a list of server configuration settings that need to be set to a certain value for the extension to work properly. In most cases this will already be the cease, so you probably don't need to bother this list.


 * (PHP) need to be set to true. If this is not done, the Google Geocoder service will not work, and you won't be able to use #geocode or #display_address.

Display a single point


You can display a map with a marker on it with the #display_point parser function. The following code will display a marker on the default map type (Google Maps), at the provided coordinates. Examples.

Note that the coordinates parameter is the default parameter for #display_point. This means that the name can be omitted, like shown below.

Geocoding
To make it easier to display a marker on an address, geocoding functionality is included in Maps. This functionality is based on the Google Geocoder extension, which you will need to un-install before using Maps. You can geocode an address with the #geocode parser function. The underneath code will return the coordinates of Moscow.

This can be easily nested in the #display_point parser function, like demonstrated below. Examples.

To avoid this nesting, another parser function, #display_address, is also available. This parser function is completely identical to #display_point, except for the parameter address, which replaces coordinates, and automatically does the geocoding for you. This code is completely synonymous to the previous example. Examples.

Note that the address parameter is the default parameter for #display_address. This means that the name can be omitted, like shown below.

Geocoding service
Maps allows you to use multiple geocoding services. Both the available geocoding services as the default geocoding service are settings, and can be modified. If you don't want to use the default service, you can specify it in the parser function.

The #geocode parser function accepts a second argument, like shown below:

display_address also accepts this argument, but in contradiction to the one in #geocode, it's named: geoservice.

In some cases, the default geocoding service will be overridden with another value.
 * In a display_address Google Maps map: google will be used as the default
 * In a display_address Yahoo! Maps map: yahoo will be used as the default

This only overrides the default geocoding service that's used when no service is provided in the parser function.

Legal warning
Both the Google and Yahoo! geocoding services have a licence that prohibits their use for anything that is not directly related to their associated mapping services, unless you have written permission. You are encouraged to read the service's licences (Google, Yahoo!) before using them.

The underneath examples are in violation of the relevant licences in most cases:

Map services


Maps provides multiple mapping services. The map service for a certain map can be set with the  parameter. When the service is omitted, the default service will be used. The underneath list contains the available mapping services. When no service is provided, the default service will be used.
 * or  - Click here for an overview of Google Maps functionality. Examples.
 * or  - Click here for an overview of Yahoo Maps functionality. Examples.
 * or  - Click here for an overview of OpenLayers functionality. Examples.

Each service has it's own unique functionality. Click the service name above for an overview of these features. See the list below for the common parameters.

Map properties


Both the #display_point and #display_address parser functions accept the following list of map properties, which can be altered to change the appearance and usage of the resulting map. This list contains only the common parameters, in other words, the parameters that can be used for every mapping service. For the specific parameters, see the map services.
 * - (display_point only) the coordinates to display a marker and also the centre of the map - you can set the default
 * - (display_address only) the address to display a marker and also the centre of the map
 * - the width of the map, in pixels - you can set the default
 * - the height of the map, in pixels - you can set the default
 * - the zoom level of the map - you can set the default
 * or  - the coordinates of the map's centre. When not provided, the map will centre itself on the provided (or default) coordinates/address.
 * - text that will be displayed in a pop-up when the marker representing the location is clicked. When used together with, the title will be bold and have a line under it.
 * - text that will be displayed in a pop-up when the marker representing the location is clicked.

Example of a Yahoo! Map:

Settings
Maps allows you to configure a variety of settings, and so affect how the extension works. All settings are located in Maps_Settings.php, in the root of the extension. You can modify a setting by copying it's code and placing it with the adapted value in LocalSettings.php, after the inclusion of Maps. Here you have a list of the common settings (the ones that affect all mapping services). For the specific settings, see the map services. Note that the settings file is documented, and should provide you with sufficient information to understand the working of all settings.

Available mapping services
Array containing all the services that will be made available to the user. Currently Maps provides the following services: googlemaps, yahoomaps, openlayers.

Default:

Default mapping service
The default mapping service, which will be used when no service is provided by the user. This service needs to be enabled, if not, the first one from the available services will be taken.

Default:

Available geocoding services
Array containing all the geocoding services that will be made available to the user. Maps 0.2 has support for 2 geocoding services: google and yahoo.

Default:

Default geocoding service
The default geocoding service, which will be used when no service is provided by the user. This service needs to be enabled, if not, the first one from the available geocoding services will be taken.

Default:

Default map coordinates
The default coordinates of the marker. This value will only be used when the user does not provide one.

Default:

Default map width
The default width of a map. These values will only be used when the user does not provide them.

Default:

Default map height
The default height of a map. These values will only be used when the user does not provide them.

Default:

Default map zoom
The default zoom of a map. This value will only be used when the user does not provide one. Each service has it's own zoom setting. Please refer to the mapping services for more info.

Version
Maps is currently at version 0.2. It is still be considered beta, since some issues might be present. However, it has been tested quite thoroughly, and should not cause any big problems. An update to this version can be expected within a few weeks, adding more functionality, fixing bugs and improving the overall extension structure.

Planned features
Curious about the upcoming features in the next release? The future work page contains on overview of the planned features, and the proposals that have been turned down.

Change log
This list only contains the versions and their release dates. For a list of all changes made, view the change log section of the legacy page.

Version 0.2 (2009-07-29)

Version 0.1 (2009-07-20)

Bugs and patches
If you found some bug and fixed it, please create a patch by going to the "Maps" directory, and typing:

svn diff >descriptivename.patch

Then add the patch to the bugs section of the future work page. Bug reports should also be added here. You can also send them to Jeroen De Dauw, jeroendedauw -at- gmail.com, and Yaron Koren, at yaron57 -at- gmail.com.

Feature requests
Feel free to add feature requests to the new proposals section of the future work page.

Translating
Translation of Maps is done through translatewiki.net. The translation for this extension can be found here. To add language values or change existing ones, you should create an account on translatewiki.net, then request permission from the administrators to translate a certain language or languages on this page (this is a very simple process). Once you have permission for a given language, you can log in and add or edit whatever messages you want to in that language.

Getting support
If you have any Maps related questions, you can add them to the Talk page. You can alternatively also place any questions on the Semantic MediaWiki mailing list, semediawiki-user. If possible, add "[Maps]" at the beginning of the subject line, to clarify the subject matter. Please contact the extensions authors only directly for urgent matters. Placing your questions on the talk page will create useful references for other people with similar problems.

Who's using Maps?
Are you using Maps? Then be sure to add your wiki to the top of this list, and feel free to link your favourite Maps-using articles!
 * BN's dev wiki Development wiki with some demo data