< Annotation and Redlining

PDF Export >

11. Export Plugins

11.1. Introduction

It is possible to export maps and data from the viewer (ie. the CartoWeb user interface) in order to print them or to save them on the user's computer. Four formats are available: PDF, CSV, HTML and raw image.

The PDF export plugin is precisely described (usage, configuration) in next chapter: Chapter 12, PDF Export.

11.2. HTML Export

The exportHtml plugin outputs an HTML simplified version of the viewer: main map, keymap and layers list. It is often launched by clicking on a "HTML print" link or button and opens a new browser window. It is specially useful to quickly (basic HTML layout, same maps used than in viewer) display raw maps in order to print them.

No configuration is required. To enable or deactivate this plugin, simply add or remove exportHtml from the loadPlugins parameter in client_conf/client.ini. For instance:

[...]

; exportHtml is listed as activated:
loadPlugins = auth, outline, exportHtml

[...]

To customized the exported page layout, simply edit the plugin template file exportHtml/templates/export.tpl. It is recommended not to modify the regular template file but to override it in a project version of the exportHtml plugin. For more info about projects, see Section 2.4, “Projects”.

To get advanced printing capabilities, rather use the CartoWeb PDF export plugin, exportPdf, described in next chapter.

11.3. CSV Export

The exportCsv plugin enables to export tabular data from various queries results in a comma-separated (CSV) or assimilated text format. The returned CSV file can then be opened and edited in any text editor or rendered as a table document in OpenOffice or MS Excel. For instance:

"Id";"Object Description"
"1";"A Line"

"CSV export" links are generally displayed in the viewer at the bottom of each queries results tables. Each link can only export a single layer table at a time.

A few configuration parameters are available in client_conf/exportCsv.ini:

  • separator indicates what character should be used to distinguish each tabular cell value. Default is ";" (semi-colon).
  • textDelimiter tells what character should be used to delimit the text in each cell. It is specially useful when the character used as the separator may be found within the cell content. Default parameter value is double-quote ie. `"`. The alias is defined to overcome INI syntax issues.
  • filename specifies the filename naming convention to use. It can include the table name (using the [table] keyword) and the generation date under various formats. Date formating is performed by indicating between a couple of brackets the keyword date, followed by a comma and PHP date()-like date format. (see http://php.net/date). Default filename convention is [date,Ymd-Hi]_[table].csv which gives for instance 20050220-2021_myLayer.csv.
  • If the charsetUtf8 boolean is set to true the result file will be UTF-8 encoded. Else ISO-8859-1 encoding is used, which is the default behavior.

After initial CartoWeb installation, client_conf/exportCsv.ini is set as follows:

; separator between each value, default is ";"
separator = ";"

; delimiter before and after each value, default is double-quote
; special characters:
;     double-quote = "
textDelimiter = double-quote

; file name format for exported CSV file, default is "[table]-[date,dMY].csv"
fileName = "[date,Ymd-Hi]_[table].csv"

; if true, exported CSV file will be UTF-8 encoded 
; if false, it will be ISO-8859-1 encoded, default 
charsetUtf8 = false

11.4. Image Output

CartoWeb enables to return a raw image map with no HTML. It is not an export plugin and thus has not to be activated anywhere. CartoWeb simply needs to receive a mode=image REQUEST parameter (GET or POST). For instance:

http://your/cartoweb3/?recenter_x=123456&recenter_y=654321&show_crosshair=1&mode=image

valid xhtml 1.0 valid css