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, the Disable Storage option is useful for trialling options without having to keep clearing the layer’s cache to see changes. This option causes tiles to be drawn according to the meta settings defined but doesn’t store the result in the cache. Don’t forget to disable it afterwards!
The first issue is map symbols looking cut-off (truncated). Consider a style configured to display like that shows up like .
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:
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:
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:
Opting to solve truncated labels using this method will result in better performance.
Some general points to note about Meta Buffer Size:
- 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
- A Meta Buffer Size of zero is safe for raster layers and line / polygon layers with thin pen styles
- 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
- Rendering performance decreases slightly as Meta Buffer Size increases
a known issue at the time of writing means that specifying a default Meta Buffer Size of 0 in the General tab of the cache settings may cause Mappin’s admin interface to stop working. See Default Meta Buffer Size of 0 Causes Admin Interface to Stop Working for more information.
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:
- Increasing Meta Tile Size reduces the occurrence of repeated labels at the expense of drawing performance
- Rendering performance decreases significantly as Meta Tile Size increases