< Bounding box history plugin

CartoWeb and WMS Usage Statistics  >

29. Saving Map Context as an URL [plugin] (exportLinkIt)

The exportLinkIt plugin displays in CartoWeb interface a URL that saves the main caracteristics of the current page. Saved data are selected layers, layers switch id, recentering info (center and scale), mapsize as well as outlined shapes and map queries.

29.1. Plugin Activation

To activate the plugin, add it to loadPlugins from CartoClient configuration file: client_conf/client.ini. For instance:

loadPlugins = exportLinkIt

You also need to add the plugin output variable {$linkIt} into the project main template templates/cartoclient.tpl (see upstream template for instance). It is recommended to add it outside of the main CartoWeb <form> tag since the generated HTML may contain an additional <form> tag. Use CSS to place the result box.

Ajax is used to generate and display the resulting URL, using the Prototype Javascript Framework. If your CartoWeb does not run in the ajaxOn mode, you need to add the Prototype file in the main template templates/cartoclient.tpl. To do so add the following HTML code within the <head> tag:

{if $linkIt|default:'' && !$ajaxOn}<script type="text/javascript" src="{r type=js}prototype.js{/r}"></script>{/if}

If Ajax mode is on, add the following code at the end of the "ajax = on" section of templates/cartoclient_ajaxHeader.tpl if it is customized in your project. If you use the regular templates/cartoclient_ajaxHeader.tpl, the JS script is already included.

{if $linkIt|default:''}<script type="text/javascript" src="{r type=js plugin=exportLinkIt}linkit.js{/r}"></script>{/if}

Also add the CSS file inclusion in templates/cartoclient.tpl:

{if $linkIt|default:''}<link rel="stylesheet" type="text/css" href="{r type=css plugin=exportLinkIt}linkIt.css{/r}" />{/if}


Your toolbar.tpl MUST contains the '{if !$tool->oneshot}...{/if}' condition on the tool activation action!!!

This is especialy important if you overrided that template in your project. Please compare with the latest cvs version of the toolbar.tpl file to be sure you have the correct conditional code.

Finally right before the </body> closing tag of your templates/cartoclient.tpl add

{if $linkIt|default:''}{$linkIt}{/if}

29.2. Plugin Configuration

Generated URL GET parameters may be obfuscated or "compressed" by setting the compressUrl to true (default is false) in client_conf/exportLinkIt.ini. When obfuscation/compression is activated, regular URLs (with standard CartoWeb GET parameters) are still accepted.

Generated URL may be rather long and thus overflow browsers or servers limits. urlMaxLength can be used to make CartoWeb output a warning message when the generated URL is longer than the specified value.

For instance:

compressUrl = true
urlMaxLength = 2000


The Generated URL will only contains the query parameters if the queried layers have the id_attribute_string metadata specified in the mapfile! (see Section 9.3.2, “Meta Data”)

valid xhtml 1.0 valid css