< 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. Six formats are available: PDF, CSV, HTML, DXF, RTF 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. DXF Export

DXF is a drawing format supported by AutoCAD and assimilated software. With CartoWeb, it is possible to export a DXF description of the shapes drawn with the outline plugin. The latter plugin must be activated before using exportDxf plugin.

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

  • roundLevel (integer) indicates how many digits must appear after the decimal point in points coordinates. Default is "2".
  • fileName (string) specifies the filename naming convention to use. It may be static or contain athe 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 export_[date,Ymd-Hi].dxf which gives for instance export_20060725-2021.dxf.
  • exportDxfContainerName (string) specifies the ID of the block containing the {$exportDxf} variable in the template when working with Ajax mode enabled. For exemple:
    exportDxfContainerName = "exportDxfContainer"
    in exportDxf.ini and
    <div id="exportDxfContainer">{$exportDxf}</div>
    in your cartoclient.tpl.

11.5. RTF Export

The Rich Text Format (RTF) is a document file format used for cross-platform document interchange. Most word processors are able to read and write RTF documents. RTF should not be confused with enriched text format which is a completely different specification.

The main goal of The ExportRtf plugin is to allow users to create templates directly in a word editor. The plugin compatibility has been tested on :

  • Office Word 2004 and later (Mac, Windows),
  • OpenOffice 2.0 and later,
  • NeoOffice (Mac)

Known incompatibilities :

  • Pages (Mac),
  • TextEdit (Mac) images are not supported,

Supported image formats (set in the mapFile):

  • JPEG,
  • GIF,
  • PNG,

11.5.1. Setting-up the template

Open your editor and do your layout setup by opening the exportRtf.rtf file in the plugin template folder.

Note

Please take into consideration that the RTF template will be generated by your editor. You may encounter some compatibility issues. For example: an RTF template done with Word can be open with OpenOffice without too many difficulties while an RTF generated with OpenOffice may not open correctly with Word.

You can insert different fields in the template by typing keywords inside triple brackets. For Example : [[[$TITLE]]]

  • $TITLE stands for a specific title of the form.
  • $MAP stands for the map. The map dimensions are defined in the exportRtf.ini.
  • $QUERYRESULTS stands for the query results. If you want to customize the table output, edit the results.tpl file.
  • $SCALEBAR stands for the scale bar.
  • $KEYMAP stands for the minimap.

You can apply word formatting and alignment to your tags. The formatting will then be reported to their contents.

Warning

When you write your tags in the file, please write them in a continuous way and without spaces and/or formatting. If you want to apply any formatting, you need to select all the tags with the "[[[ ]]]" included. If by mistake an RTF tag is inserted inside the brackets, you will have to erase the tag and rewrite it or edit the RTF sources and remove the RTF keywords.

11.5.2. Configuration parameters

You will find some configuration parameters in the exportRtf.ini file

;fields shown in the form
activatedBlocks = mainmap,title,scalebar,overview,queryResult
;dimention of the map in pixels X*Y
mapDimention ="400*400"
;allowed roles for the Auth plugin 
allowedRoles = all
;rtf optional inputs 
optionalValues = ref,num,other

11.5.3. Optional Inputs

You can add free dynamic content inside your RTF. For instance, to insert a reference number in you RTF file:

First, you have to add the name of your optional fields in the exportRtf.ini file. Please do not use special characters there. Please do not use special characters here.

optionalValues = ref,num,other

Then, open the exportRtf.rtf file with you favorite word editor and just add tags the same way you do it for standard components.

 [[[$REF]]] [[[$NUM]]] [[[$OTHER]]] 

This tags are case sensitive and have to be in UPPER CASE. The optionalValues parameters that you have set in the ini file have generated some hidden inputs in the HTML output. These inputs are named with the prefix "optRtf" and the tag name.

<input id="optRtfref" type="hidden" name="optRtfref" value=""/>

To have a value shown in the RTF, you just have to set a value to the corresponding HTML input.

//JavaScript
     $('optRtfref').value ='123';

Note

If you want to have an optional input available in a form (like a text input), you can simply remove its name from the ini file. Then open an HTML template and add a form field name, which must contain the prefix "optRtf" and the tag name.

11.6. Image Export

CartoWeb offers 2 way to get an image.

11.6.1. exportImg

To display only the map image without the other elements of the main template, you can simply add ?exportImg to the url.

http://yourservername/yourproject.php?exportImg

The template used is imgoutput.tpl in the main templates folder. It can be customised to your needs.

This plugin must be activated in your client.ini list of plugins.

11.6.2. mode=image

CartoWeb allows 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

See Section 2.4.2.2, “Available Parameters” for more details about the possible extra parameters allowed by this feature.

valid xhtml 1.0 valid css