It seems like raster tiles have started to go out of fashion, but still, I need a solution to do it somehow for my QGIS Server's WMS.
Up to this point I have tried TileCache, but I couldn't make it to work in OL3, and it also seems to be a little "oldish".
So what would be my best bid, if later I would like to use the cached layer in my OL3 application? TileStache, Mapproxy, MapCache?
I have my QGIS Server running under CentOS 7.
QGIS Server works well with MapProxy. With QGIS Server+MapProxy you will get the best of the QGIS styling plus the speed of a tile cache.
MapProxy is written in Python and you probably already have Python installed on the server. You can (and you should) run MapProxy in a virtual environment. The MapProxy instructions are quite clear and it is really a question of minutes to have it up and running, fetching data from QGIS Server.
tiled: true
in your WMS request)Example
There are very nice small examples in the MapProxy documentation.
This one is one of the most complicated examples, because it uses a custom grid and a CRS other than EPSG:3857. If you use the usual
GLOBAL_MERCATOR
grid, it is much simpler (on the MapProxy side and on the OpenLayers side).This is a small example of a
mapproxy.yaml
configuration file, with a custom grid. The source is QGIS Server. I've added aGetFeatureInfo
request on mouse click to show how these requests can be forwarded to QGIS Server. I've also added the layer's legend (usingservice=WMS&REQUEST=GetLegendGraphic&VERSION=1.3.0
).The following OpenLayers file is able to take fetch the tiles from MapProxy.