[[TOC]] = Inserts a static Google Map as image = == Description == This macro uses the [http://code.google.com/apis/maps/documentation/staticmaps/ 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 http://maps.google.com/. 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. == Installation == Use can `easy_install` this macro: {{{ easy_install http://trac-hacks.org/svn/googlestaticmapmacro/0.11 }}} If you use Subversion 1.5.x you might get an error, then just try: {{{ svn export http://trac-hacks.org/svn/googlestaticmapmacro/0.11 googlestaticmapmacro easy_install googlestaticmapmacro }}} Afterwards you can remove the `googlestaticmapmacro` folder. On some Linux systems you might need to run `easy_install` using `sudo`, e.g: `sudo easy_install ....` == Configuration == To enable this macro put the following into your `trac.ini` configuration file: {{{ [components] tracgooglestaticmapmacro.* = enabled }}} == Bugs/Feature Requests == Existing bugs and feature requests for GoogleStaticMapMacro are [report:9?COMPONENT=GoogleStaticMapMacro here]. If you have any issues, create a [http://trac-hacks.org/newticket?component=GoogleStaticMapMacro&owner=martin_s new ticket]. == Download == Download the macro as [download:googlestaticmapmacro/0.11 ZIP-file]. == Installation & Configuration == Just copy the [http://trac-hacks.org/browser/googlestaticmapmacro/0.11/googlestaticmap.py?format=raw 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 [http://code.google.com/apis/maps/signup.html 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] googlestaticmap.* = enabled [googlestaticmap] api_key = # Optional settings: #default_size = 300x300 #default_language = de }}} == Source == You can check out GoogleStaticMapMacro from [http://trac-hacks.org/svn/googlestaticmapmacro here] using Subversion, or [source:googlestaticmapmacro browse the source] with Trac. == Usage & Examples == === Parameters === See http://code.google.com/apis/maps/documentation/staticmaps/#URL_Parameters 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: {{{ [[GoogleStaticMap(center=50.805935:10.349121,zoom=5,size=400x400)]] }}} will result in the following map image: [[Image(http://maps.google.com/staticmap?center=50.805935%2C10.349121&zoom=5&size=400x400&key=ABQIAAAAMwTA9mkyZbDS6QMcxvwm2BQk7JAK84r7ycdvlw9atwcq_yt-SxQd58w7cbhU8Fvb5JRRi4sH8vpPEQ,nolink)]] === Markers === 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. So, {{{ [[GoogleStaticMap(center=50.805935:10.349121,zoom=5,size=400x400,markers=50.805935:10.349121:bluea|50.000000:10.000000:greenb|49.046195:12.117577:yellowc)]] }}} will result in the following map image: [[Image(http://maps.google.com/staticmap?center=50.805935%2C10.349121&zoom=5&size=400x400&markers=50.805935%2c10.349121%2cbluea|50.000000%2c10.000000%2cgreenb|49.046195%2c12.117577%2cyellowc&key=ABQIAAAAMwTA9mkyZbDS6QMcxvwm2BQk7JAK84r7ycdvlw9atwcq_yt-SxQd58w7cbhU8Fvb5JRRi4sH8vpPEQ,nolink)]] == Recent Changes == [[ChangeLog(googlestaticmapmacro, 3)]] == Author/Contributors == '''Author:''' [wiki:martin_s] [[BR]] '''Contributors:'''