Changes between Version 19 and Version 20 of GoogleStaticMapMacro


Ignore:
Timestamp:
Aug 31, 2010 7:34:12 PM (4 years ago)
Author:
martin_s
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • GoogleStaticMapMacro

    v19 v20  
    1212 
    1313The 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. 
     14The AdvParseArgsPlugin is used to allow for quoted argument values and must also be installed. 
    1415 
    1516 
     
    5354 
    5455== Upgrade from older Versions ==#Upgrade 
    55 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]. 
     56The 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] 
     57([http://code.google.com/apis/maps/documentation/staticmaps/upgrade.html Upgrade guide]). 
    5658The 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.  
    5759The older syntax can still be used with newer versions of the macro by setting `api=1` either as a macro argument (`[[GoogleStaticMap(api=1,<old syntax>)]]`) or using the global [#config configuration] option `default_api_version`. 
     
    6971 key:: Sets the API key if not set globally in the config file. Deprecated for macro v1.x / Google API v2. 
    7072 
    71 The map location must be given in geographic coordinates, not as address.  
    72 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. 
     73All map locations (center, markers, path) can now be given as address or geographic coordinates (latitude,longitude). Please note that addresses and coordinates __must__ be quoted using double-quotes (`"`) when they include a comma. This is always the case with coordinates. The old macro syntax used colons (`:`) as substitutes, which no longer supported in the new syntax.  
    7374 
    7475For example: 
    7576{{{ 
    76 [[GoogleStaticMap(center=50.805935:10.349121,zoom=5,size=400x400)]] 
     77[[GoogleStaticMap(center="50.805935,10.349121",zoom=5,size=400x400)]] 
     78[[GoogleStaticMap(center="Germany",zoom=5,size=400x400)]] 
    7779}}} 
    7880 
    79 will result in the following map image: 
     81will both result in the following map image: 
    8082 
    8183[[Image(http://maps.google.com/staticmap?center=50.805935%2C10.349121&zoom=5&size=400x400&key=ABQIAAAAMwTA9mkyZbDS6QMcxvwm2BQk7JAK84r7ycdvlw9atwcq_yt-SxQd58w7cbhU8Fvb5JRRi4sH8vpPEQ,nolink)]] 
     
    8385 
    8486=== Markers === 
    85 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. 
    86 Multiple marker declarations are separated using the '`|`' letter. 
     87You can add markers to the static map using the '`markers`' argument. The format is '`markers=style settings|first location|next location|...`' 
     88([http://code.google.com/apis/maps/documentation/staticmaps/#Markers details]), 
     89e.g.: `markers="size:mid|label:A|color:blue|50.805935,10.349121"`, creates a blue marker labeled with 'A' at 50.805935,10.349121. Again also addresses can be used to specify locations. 
     90The whole value must be quoted if any commas are included. Multiple `markers` arguments can be given to add markers with different styles. 
    8791 
    8892So, 
    8993{{{ 
    90 [[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)]] 
     94[[GoogleStaticMap(center="50.805935,10.349121",zoom=5,size=400x400,markers="color:blue|label:A|50.805935,10.349121",markers="color:green|label:B|50.000000,10.000000|Berlin,Germany",markers="color:yellow|label:C|Regensburg,Germany")]] 
    9195}}} 
    9296will result in the following map image: 
    9397 
    94 [[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)]] 
     98[[Image(http://maps.google.com/maps/api/staticmap?center=50.805935%2C10.349121&zoom=5&markers=color%3Ablue%7Clabel%3AA%7C50.805935%2C10.349121&markers=color%3Agreen%7Clabel%3AB%7C50.000000%2C10.000000%7CBerlin%2CGermany&markers=color%3Ayellow%7Clabel%3AC%7CRegensburg%2CGermany&hl=en&sensor=false&size=400x400,nolink)]] 
     99 
     100=== Paths === 
     101Paths between locations can be added using the `path` argument which has basically the same syntax as `markers`, except different styles are supported. See [http://code.google.com/apis/maps/documentation/staticmaps/#Paths the Google documentation] for details. 
     102 
     103== Processor Syntax == 
     104While Tracs normal macro syntax (`[[Macro(key=value,key=value)]]`) is nice for smaller arguments lists it is getting messy for longer lists.  
     105This macro now also supports the so called ''wiki processor syntax'' (`{{{ <linebreak> #!Macro <linebreak> content <linebreak> }}}`) to allow for multiple lines of arguments. 
     106In this case a line break will be read as a comma: 
     107{{{ 
     108{{{ 
     109#!GoogleStaticMap 
     110key1=value1 
     111key2="value 2, with comma" 
     112key3=value3,key4=value4 
     113}}} 
     114}}} 
     115is identical to: 
     116{{{ 
     117[[GoogleStaticMap(key1=value1,key2="value 2, with comma",key3=value3,key4=value4)]] 
     118}}} 
     119 
     120'''Example:''' 
     121{{{ 
     122{{{ 
     123#!GoogleStaticMap 
     124center="Germany" 
     125path="Munich|Berlin|Cologne|Munich" 
     126markers="label:M|Munich" 
     127markers="label:B|Berlin" 
     128markers="label:K|Cologne" 
     129markers="label:H|color:orange|Hamburg|Hannover" 
     130markers="size:small|color:green|Mannheim|Straubing|Münster" 
     131size=250x300 
     132}}} 
     133}}} 
     134produces: 
     135[[Image(http://maps.google.com/maps/api/staticmap?center=Germany&markers=label%3AM%7CMunich&markers=label%3AB%7CBerlin&markers=label%3AK%7CCologne&markers=label%3AH%7Ccolor%3Aorange%7CHamburg%7CHannover&markers=size%3Asmall%7Ccolor%3Agreen%7CMannheim%7CStraubing%7CM%C3%BCnster&hl=en&path=Munich%7CBerlin%7CCologne%7CMunich&sensor=false&size=250x300,nolink)]] 
    95136 
    96137