# Mapnik Rendering Layer

The Mapnik Rendering Layer uses the Mapnik Library to generate map images according to the Mapnik configuration.

When using this layer it is useful to review the prefs_mapnik to ensure the settings are correct for your system.

Mapnik configurations can be created via the CartoCSS Mapnik stylesheet pre-processor. &appname; will automatically invoke the carto program when a carto project file is specified. Currently &appname; can not tell when an included file of the project has changed, so there is an option to manually run the carto command.

&appname; will only (re)render tiles when it believes it is necessary - such as when there is no tile in the file cache, when there is a new Mapnik configuration style or the tile is over a certain age. To force &appname; to (re)render all tiles - create the file `planet-import-complete` in your config_file_loc and/or update its timestamp. (e.g. using the touch command).

Creating a Carto project or an initial Mapnik configuration file and maintaining the datasource is beyond the scope of this documentation. There are various existing Carto projects such as OSM Carto or OSM Bright. These use OSM data and contain guides on how to setup the datasource. Further detail about using OSM data can be found on the Switch2OSM website.

If you use a simple Mapnik configuration then the tile rendering time can be negligible and you can avoid having a tile cache. However for most systems using a stylesheet of similar complexity to the OSM Carto styling, rendering a tile (including reading/acquiring the data) can take some time and thus several seconds to generate a display screen's worth of tiles. Hence &appname; runs these tasks in the background and uses the tile cache to save this output.

Generated tiles are stored in the PNG format in the standard OSM Tile name layout.

Currently due to code build and dependency complexities, Mapnik Rendering is not available in the Windows version of &appname;

## Layer Properties

Configurable properties:

## Carto project file

When specified, this is used to generate the mapnik configuration file.

## Mapnik configuration file

Specify the Mapnik configuration file or leave it blank when using a Carto project file.

## Alpha

Control the Alpha value for transparency effects using a value between 0 and 255 with the default being 255 for a fully solid image, whereas 0 is transparent.

## Use File Cache

The default is to use a file cache.

## Tile cache directory

The top level directory of where the generated tiles are stored.

## Layer Operations

These extra options are available when right clicking on the Mapnik Rendering Layer in the Layers Panel.

## Refresh

Reload the Mapnik configuration.

## Run Carto Command

Force running the carto command and reload the generated Mapnik configuration.

## About

Show some information about the Mapnik version in use.

## Viewport Tools

When a Mapnik Rendering Layer is selected in the Layers Panel, the Mapnik Features tool can be selected from the toolbar. This enables location dependent actions to be invoked by right clicking on the viewport and selecting an action from the drop down menu.

- Rerender Tile.

- Tile Info