Map Macro
Zuletzt geändert von xwikiadmin am 2024/01/25 22:03
Contents
Description
Displays an interactive geographical map.
This macro does not supports inline mode.
Content
The content is optional and is used for displaying information in a popup activated on click. With Leaflet, if there is no content a click leads to the OpenStreetMap routing service.
Parameters
Name | Mandatory | Values | Default | Description |
---|---|---|---|---|
location | Yes | * | - | Address of a place |
width | No | [0-9]+px or % | 500px | The width in pixels or in percent the map container will take |
height | No | [0-9]+px or % | 400px | The height in pixels or in percent the map container will take |
zoom | No | [0-9]+ | 15 (which is about the size of a block of houses) | The initial zoom the map will be focused at. Please refer to your provider API reference for intelligible values. |
errors | No | show / hide | show | Display a popup with the returned status code when it is anything other than "OK" |
locationType | No | address/latlng | address | address (default) or latlng ( in this case the location should be a geographic coordinate like : 47.156427, 27.576387) | Specify the type of location, possible values :
tiles | No | OSM tile server | URL scheme of the tile provider. Example: https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png (default). See also: OpenStreetMap tile servers. The tile provider can be set either from the map macro administration page (see below) or at the macro level. |
Administration
Examples
Map with default OpenStreetMap tiles
Code:
{{map location="35 rue Beaubourg, 75003 Paris, France" /}}
Result:
Map using geographic coordinates and percent width
Code:
{{map location="47.156427, 27.576387" locationType="latlng" width="50%" /}}
Result:
Map with information popup
Code:
{{map location="Rue des Thermopyles, 75014 Paris" width="400px" height="300px"}}
A beautiful street in Paris
{{/map}}
A beautiful street in Paris
{{/map}}
Result:
A beautiful street in Paris
Map with custom tiles
Code:
{{map location="35 rue Beaubourg, 75003 Paris" tiles="http://{s}.tile.stamen.com/watercolor/{z}/{x}/{y}.jpg" /}}
Result:
Map with Google Maps tiles
In order to use the Google Maps tiles, head to the map macro administration section as explained above, and select "Google Maps" library. In that case, you don't need to fill in any tile server as it is automatically set to the Google Maps one.
Google Maps Events
If you use the Google Maps library, the events listed below are available.
Name | Description |
---|---|
GMAPS:OK | Indicates that no errors occurred; the address was successfully parsed and at least one geocode was returned |
GMAPS:ZERO_RESULTS | Indicates that the geocode was successful but returned no results. This may occur if the geocoder was passed a non-existent address. |
GMAPS:OVER_QUERY_LIMIT | Indicates that you are over your quota. |
GMAPS:REQUEST_DENIED | Indicates that your request was denied. |
GMAPS:INVALID_REQUEST | Generally indicates that the query (address, components or latlng) is missing. |
GMAPS:UNKNOWN_ERROR | Indicates that the request could not be processed due to a server error. The request may succeed if you try again. |