I cannot figure out where the problm is. I use GeoServer and Leaflet. My problem is that when I visualise some layers (in particular that with the names of the clients) I cannot see them all at each zoom level as I in the layer preview in Geoserver. Why?? The SLD must be correct otherwise I wouldn't have a correct preview right? Then when I load the site in Leaflet and I zoom in and out I cannot see all the names of the clients. I also have a similar problem with pie-chart: in layer preview they are perfect, while in leaflet are cut or not visible. Where is the problem? Moreover, is there a way to solve it??
1 Answer
You are not telling us how you get the WMS in Leaflet: are you using the default object or a plugin?
I have experiences the "cut" issues with labels too.
I suspect that the problem might come from the fact that Leaflet WMS object is a extension of the Tile object and somehow in the request processing somehting ges wrong. The geometric object to which the label correspond is one one tile and the labels would be on two tiles, if it were a tile system. However, as the geometric object is not on the second tile, its label is not rendered and thus you get "cut" labels. => Check whether the issue always appear at the "tile" borders.
Maybe this plugin can help you: https://github.com/heigeo/leaflet.wms
Or you might want to change the default size of tiles, so that you get one big tile (the tile must be slightly bigger than the size of your map on the screen)
-
1Really helpful answer! I just noticed that in the Geoserver layer preview there is the option "Tiled" or "Single Tile" and if I choose the former I get the same "mistake" where the latter allows me to see everything in terms of labels and pie charts. I'm giving a look to the link you suggested me...thank you @Djana Commented Jul 14, 2015 at 9:59
-
did you use this same plugin to resolve your issue? that's my piece of code about the layer: function layerGeoserver(lName, opac){ var lay = L.tileLayer.betterWms("http://" + ip + ":" + geoserverPort + "/geoserver/" + geoserverWorkspace + "/wms", { version: wmsVersion, layers: geoserverWorkspace + ':' + lName, format: 'image/png', transparent: true, attribution: layersAttrib, }); Commented Jul 14, 2015 at 10:04
-
Good to know about the parameter in Geoserver, I didn't know that, but I will definitely pay attention to it now.– DjanaCommented Jul 14, 2015 at 11:45
-
see gis.stackexchange.com/questions/156904/… for a solution to the cut labels Commented Oct 19, 2017 at 15:00