wiki:GoogleMapMacro

Version 10 (modified by anonymous, 5 years ago) (diff)

Added default values

Inserts a dynamic Google Map into wiki pages

Description

This macro lets the user insert a full dynamic Google Map. Because a lot of javascript is used (by Google) a Google Map compatible browser is needed. Newer version of Firefox and MS Internet Explorer are compatible.

For javascript-less static maps use the similar GoogleStaticMapMacro.

Please note that this is an alpha version which still lacks a lot of functionality.

Multiple Google Maps on the same wiki page are actively supported but are more likely to cause trouble.

Bugs/Feature Requests

Existing bugs and feature requests for GoogleMapMacro are here.

If you have any issues, create a new ticket.

Download

Download the zipped source from here.

Source

You can check out GoogleMapMacro from here using Subversion, or browse the source with Trac.

There is a develop version which can be unstable: check-out | browse

Installation & Configuration

Just copy the python file in the plugin directory of your trac installation.

A different Google Map API key is needed for every web domain which can be get for free from Google.

To enable the macro put the following into your trac.ini file, which is located in the config directory of your trac installation. You need to restart trac to reread the macro file and the configuration file.

[components]
googlemap.* = enabled

[googlemap]
api_key = <Your Google API key (long hex number)>
## Optional default settings:
#default_size = 400x400
#default_zoom = 6

Usage

The macro knows the following arguments, which can be used in the normal 'key1=value1,key2=value2,...' syntax.

address (or no key)
Sets the center of the map to the given address. Please use semi-colons (';') to separate the street, city and country. The value can be surrounded by quotes, e.g. "Street; City; Country".
center
Sets the center of the map to the given coordinates. The format is {longitude}:{latitude}.
zoom
Sets zoom factor. Allowed values are between 0 (whole world) and 19 (single house). Very high zoom values might not be supported by Google Maps for all parts of the world.
size
The size in the format {width}x{height} as numbers in pixel, e.g.: 300x300 means 300px width and height.
type
Sets the initial map type. The following types are supported:
  • normal Normal street-map
  • satellite Satellite picture
  • hybrid Satellite picture with streets as overlay
  • physical Terrain map
types (not implemented yet)
Sets the map types selectable by the user, separated by colons (':'). See the type argument for the available types. If this argument is given but not no initial map type, the first listed type is used initially.

Examples

Using geographic coordinates

Please use a colon, not a comma, as separator for the coordinates.

[[GoogleMap(center=50.0:10.0,zoom=10,size=400x400)]]

Using an address

Please use semicolons, not commas, as separators in the address.

[[GoogleMap(address="Street; City; County",zoom=10,size=400x400)]]

or

[[GoogleMap("Street; City; County",zoom=10,size=400x400)]]

Please note that the address is converted into coordinates by user-side javascript every time the wiki page is loaded. If this fails no map will be shown, only an empty gray rectangle.

Server side address conversion including caching is underway.

Using both

Doesn't make this much sense, but is supported anyway. This could be used as failsafe if you aren't sure if the address resolution will be successful.

[[GoogleMap(center=50.0:10.0,address="Street; City; County",zoom=10,size=400x400)]]

The given coordinates will be shown until the address is resolved, which can take a little when the user has a slow internet connection. After (and if) the address is resolved the map will be centered on it.

Select initial Map Type

To show an satellite map:

[[GoogleMap("Street; City; County",zoom=10,size=400x400,type=satellite)]]

Recent Changes in the Release Branch

[8649] by martin_s on 2010-09-06 12:08:31
tracgooglemap/macro.py
Added support for mulit-line wiki processor syntax. Ref: 7628.
[8648] by martin_s on 2010-09-06 12:07:24
Added stylesheet file.
[8546] by martin_s on 2010-08-30 23:57:36
Added encoding meta-comment and declared SVN keywords as unicode to avoid issues with non-english locales.

Recent Changes in the Develop Branch

Error: Macro ChangeLog(googlemapmacro/dev/0.11, 3) failed
No node googlemapmacro/dev/0.11 at revision 13862

Author/Contributors

Author: martin_s
Contributors: