javascriptleafletgeoserverwmstiling

Problem of tiling with GeoWebCache: most tiles are missing


I set up a PostGIS database that I added in GeoServer via a parameterized SQL view. I used Leaflet to display this layer via wms.

It worked fine until I add GeoWebCache using the url "/geoserver/gwc/service/wms" instead of "/geoserver/wms". I can still see my polygons when I'm at the minimal zoom. But then when I zoom I see only a red polygon and a half of a green polygon and if I zoom again I see only the red polygon. You can see these 3 states on the images below:

3 different zooms on my map

I guess this is a problem of tiling: I get the minimal tiles and also some tiles around the red polygon for further zooms but for some reason it seems that the other tiles are not sent.

Here is the code I use to get my wms layer with leaflet:

geoJSONlayer = L.tileLayer.wms("/geoserver/gwc/service/wms", {
    layers: 'cartowiki:choix',
    format: 'image/png',
    transparent: true,
    viewparams: 'year:'+(annee+3000)
}).addTo(map);

geoJSONlayer.addTo(map);

Do you have an idea of the problem here ?

Thanks in advance,


Solution

  • The bounding box was the problem indeed. In Geoserver, I had to modify the properties of the layer in 2 places :

    I hope it can help someone in the future!