Meta Cache Settings

The map you see published by Mappin is actually a collection of smaller map tiles. Map tiles are usually 256px by 256px images but their size can be changed in the Map module. Drawing each tile independently can cause some issues which can be resolved using the meta settings discussed here.

When experimenting with meta settings, disabling the layer’s Cache option is useful for trialling options without having to keep clearing the layer’s cache each time to see changes.

Meta Buffer

The first issue is map symbols looking cut-off (truncated). Consider a style configured to display like full_symbol that shows up like cut_symbol.

This occurs when the point is very close to the edge of a drawn tile. The point sits in only one tile but its symbol is larger and straddles both tiles. As tiles are drawn independently, the right-hand tile does not render the point as it is not within its bounds and we end up with a truncated symbol shown only on one tile:

../_images/meta_buffer_explanation.png

The Meta Buffer Size option can be used to solve this problem. This causes Mappin to draw a slightly larger tile and then crop it to the requested size. This means the point will be drawn in both tiles and will not look truncated.

To calculate an optimal setting for Meta Buffer Size, capture a screenshot of a completely drawn symbol from Mappin in the web browser and measure its drawn height and width in pixels:

../_images/measured_symbol.png

Now set Meta Buffer Size = ceiling(max(height,width)/2)

In the example shown above, a Meta Buffer Size of 22px works well.

Traditionally, Meta Buffer Size might also be used to address truncated labels too. Although truncated labels can be mitigated using this setting, it is no longer necessary if you disable QGIS’ Allow truncated labels on edges of map option in the layer’s label settings:

../_images/allow_truncated_labels.png

Opting to solve truncated labels using this method will result in better performance.

Some general points to note about Meta Buffer Size:

  1. A Meta Buffer Size > 0 may be required to fix drawing issues with line / polygon layers drawn with thick pen styles which extend noticeably beyond a feature’s line / boundary
  2. A Meta Buffer Size of zero is safe for raster layers and line / polygon layers with thin pen styles
  3. Opt to disable QGIS’ Allow truncated labels on edges of map labelling option in preference to increasing Meta Buffer Size when trying to solve truncated labels
  4. Rendering performance decreases slightly as Meta Buffer Size increases

Meta Tile

The second issue is repeated labels appearing on large labelled polygon and line features. Again, this is because each tile is being rendered independently and a large polygon may end up being drawn across many adjacent tiles. If labelling is enabled for the layer, the labels will most likely appear on each tile.

This issue can be addressed using the Meta Tile Size setting. When set to a value of 2, Mappin will draw a larger map tile, 2x larger than the map tile requested by the browser. Once drawn, this larger tile will be chopped into smaller tiles of the requested size before being sent to the browser. This results in repeated labels being shown less frequently.

Beware that increasing Meta Tile Size will put significantly more load on Mappin (drawing larger tiles) and high values may cause drawing of layers with complex styles (e.g. OS MasterMap) to fail. For precise control over labelling, using a point layer to position labels is recommended.

Some general points to note about Meta Tile Size:

  1. Increasing Meta Tile Size reduces the occurrence of repeated labels at the expense of drawing performance
  2. Rendering performance decreases significantly as Meta Tile Size increases