Version 18 (modified by Ryan J Ollos, 14 years ago) (diff)

Add maintainer

Insert a static Google Map as image


This macro uses the Google Map API to include static images of maps. Static means that is is only a simple image without any user interaction not the usual feature-rich dynamic map on The positive side is that no javascript is needed to display the map image.

For a dynamic Google map use GoogleMapMacro.

The maximum size supported by Google is 640x640 pixels. If a bigger width or height is requested it will be reduced to 640px.


To enable this macro put the following into your trac.ini configuration file:

tracgooglestaticmapmacro.* = enabled

Bugs/Feature Requests

Existing bugs and feature requests for GoogleStaticMapMacro are here.

If you have any issues, create a new ticket.


Download the macro as [download:googlestaticmapmacro/0.11 ZIP-file].

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.

googlestaticmap.* = enabled

api_key = <Your Google API key (long hex number)>
# Optional settings:
#default_size = 300x300
#default_language = de


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

Usage & Examples


See for all supported arguments. In addition the image title can be set using a title argument.

The map location must be given in geographic coordinates, not as address. Please note that the format center=X:Y must be used, not center=X,Y as described in the above web site, due to the way trac parses the macro.

For example:


will result in the following map image:


You can add markers to the static map using the 'markers' argument. The format is 'markers={latitude}:{longitude}:{size}{color}{alphanumeric-character}', e.g.: markers=50.805935:10.349121:bluea, creates a blue marker labeled with 'A' at 50.805935,10.349121. Multiple marker declarations are separated using the '|' letter.



will result in the following map image:

Recent Changes

17137 by rjollos on 2018-04-16 19:58:39
TracGoogleStaticMapMacro 1.1: Conform to PEP8
15264 by rjollos on 2016-02-11 04:22:34
Remove unnecessary svn:mime-type on py files

svn:mime-type was set to "plain" for many files.

8571 by martin_s on 2010-08-31 18:02:58
Increaded version number to indicate major change due to Googles API change.
Fixed colon substitution for markers for api=1.


Author: martin_s
Maintainer: martin_s