[[TOC]] = Insert 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 the GoogleMapMacro. Please note that the maximum size supported by Google is 640x640 pixels. If a bigger width or height is requested it will be reduced to 640px. The macro should work both with Trac 0.11 and 0.12. At the moment there is only a 0.11 directory which can also be used for Trac 0.12. == 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]. == Source == You can check out GoogleStaticMapMacro from [http://trac-hacks.org/svn/googlestaticmapmacro here] using Subversion, or [source:googlestaticmapmacro browse the source] with Trac. == Installation & Configuration ==#config Install the plugin [http://trac-hacks.org/#HowdoIinstallthesethings as usual]. 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] tracgooglestaticmap.* = enabled [googlestaticmap] api_key = # not required for API v2 # Optional settings: #default_size = 300x300 #default_language = de #default_api_version = <1 or 2> # should be 2 for newer installations. Set to 1 if you want to keep older macros unchanged }}} == Upgrade from older Versions ==#Upgrade The current version of the macro uses the [http://code.google.com/apis/maps/documentation/staticmaps/ Google Static Map API v2], while older versions used [http://code.google.com/apis/maps/documentation/staticmaps/v1/ API v1]. The syntax provided by Google has changed between the API versions. In order to provide the newer features but also not break existing macros both API versions are supported using the `api` key. The older syntax can still be used with newer versions of the macro by setting `api=1` either as a macro argument (`[[GoogleStaticMap(api=1,)]]`) or using the global [#config configuration] option `default_api_version`. Please note, that since v2 an API key is not required anymore by Google. I'm not sure if this is also true for v1. The trac server specific Google Map API key can be [http://code.google.com/apis/maps/signup.html received from Google for free]. == Usage & Examples == This documentation describes the syntax for the macro v1.x which uses Google's API v2 (see [#Upgrade]). The older syntax is still supported using the `api=1` argument. See [./GoogleStaticMapMacro?version=18 an older version] of this wiki page for the old syntax. Mixing of older and newer syntax is not supported. === Parameters === The macro accepts the official [http://code.google.com/apis/maps/documentation/staticmaps/#URL_Parameters Google Static Map argument (see there)] as well as a few internal arguments: title:: Sets the HTML title of the map image. api:: Sets the API version to be used. By default set to "`2`". To reuse the older macros set `api=1` as mentioned earlier. key:: Sets the API key if not set globally in the config file. Deprecated for macro v1.x / Google API v2. 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]] '''Maintainer:''' [wiki:martin_s] [[BR]] '''Contributors:'''