2

I have created a vector layer using GeoServer. Now, i have a GeoServer WMS for that layer. I would like to implement tile caching. I tried TileCache tool. But i have encountered a problem then i asked the solution in this question, but nobody answered it.

When i use the TileCache tool for tile caching, i can use it with Leaflet. Like this;

var layername = L.tileLayer.wms("https://tile-cache-server-adress/tilecache/tilecache.py", {
    layers: 'LayerName',
    format: 'image/png',
    transparent: true,
    attribution: "",
    maxZoom: 20
});

So, is there another way to implement tile caching a vector layer (WMS) and publish it as a WMS again for using with Leaflet?

1 Answer 1

6

Geoserver has it's own tile cache called GeoWebCache. GWC is integrated directly in Geoserver so trying to use a 3rd party solution like TileCache is adding an extra layer of unnecessary complication, especially when GWC works so well. To implement GWC see here.

The first link will show you how to setup GWC and how to construct the correct URL. However, briefly, in Leaflet you need to include tiled: 'true' in the request and you need to point the url at the gwc endpoint of your geoserver instance in the form of: http://example.com/geoserver/gwc/service/wms

Although, for speed it obviously helps to seed the cache first and GeoServer has tools for that too (but that would be a different question). It is worth noting that you don't have to seed the cache first or use any external program to create the tiles. Any request to GWC will either be fetched from the cache or, if it doesn't exist, it will be rendered and cached.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.