Map Macro

This is a XWiki macro, which isn't bundled with any XWiki product by default.
Macro contributed by Jerome Velociter.
This macro can be downloaded.

Map Macro

Description

Displays a geographical map, provided by popular services (Google Maps or Y! Maps), with which users can interact. The loading of the map is deferred after the full loading of the page, so the connection to the map provider does not block the rest of the content.

Warning: This macro is currently released as alpha. Its compatibility has not yet been extensively tested against various browsers (especially Internet Explorer 6). Feedback is very welcome, it will help releasing a stable version faster. You can reach this macro's developer at jerome AT xwiki.com.

Note that you will need connectivity back and forth from the wiki to google servers for the macro to work properly - This might not be the case for a Intranet in a corporate environment, for example.

Usage

Content

The content is mandatory, and represents the location to map.

Parameters

NameMandatoryDescription
messageNoA message to display as legend of the location mapped
widthNoThe width in pixels the map container will take.
heightNoThe height in pixels the map container will take.
providerNoThe map provider. Accepted values are : "google" (An alias for Google Maps API V3), "gmapsV2", "gmapsV3", "yahoo". The "yahoo" provider requires an API key, so please refer to the configuration section to precise which API key the wiki should use. Unless configured differently (see configuration section), the default provider is "google".
zoomNoThe initial zoom the map will be focused at. Please refer to your provider API reference for intelligible values. Default is 15, which is about the size of a block of houses for the Google provider.

Configuration

Default provider

You can configure which provider should be used as the default map provider. If not configured, Google Maps V3 will be used. To change this value to use Y! Maps instead, you will need to add a maps.defaultprovider String Property to the XWiki.XWikiPreferences class, and precise yahoo in the XWiki.XWikiPreferences object.

API key

The default provider (Google Maps V3) does not need an API key, so if you do not wish to use another provider it will work just fine and you can skip this step. To precise the API key for Y! Maps, you need to add a maps.yahoo.apikey String Property in XWikiPreferences class, and precise its value with the object editor. Google Maps V2 is supposed to need an API key, although it looks like it works fine without. To precise its API key anyway, create an maps.google.apikey property in XWiki.XWikiPreferences.

Examples

Map 1

Code

{{map}}10, rue Pernety, France{{/map}}

Result (as image)

map1.png

Map 2

Code

{{map message="A beautiful street in Paris" width="400" height="300"}}Rue des Thermopyles, 75014 Paris{{/map}}

Result (as image)

map2.png

Map 3

Code

{{map message="Where I grew up" zoom="6"}}Le Louroux Beconnais, France{{/map}}

Result (as image)

map3.png

Tags:
Created by Jerome Velociter on 2009/09/14 21:40
Last modified by Jerome Velociter on 2009/11/25 10:04

This wiki is licensed under a Creative Commons license
2.2.1.27354