1

I have a layer in geoserver that contains data of different levels: Country boundary, Province Boundary and District boundary in a single file(distinguishable from attribute fields). I have loaded the geoserver layer in Leaflet as tiled wms layer. I want to show only country boundry at first and when the user zooms in to an extent (say zoom level 7), then show the provincial bounds and so on.Is it possible to do so with only one layer considering attributes? (I don't want to load multiple layers). This is what I've done to load wms layer:

var mywms = L.tileLayer.wms("http://localhost:8080/geoserver/topp/wms", {
    layers: 'topp:boundaries',
    format: 'image/png',
    transparent: true,
});

mywms.addTo(map);
  • Yes, you can set up a group layer, and then set up min max scale ranges in the SLD for each of the layers in the group. – nmtoken Sep 25 at 10:46
  • be aware though that a WMS has no concept of zoom levels, that's an artefact of the way Leaflet and other web clients view data, so you'll need to work out the scales associated with the zoom levels you require – nmtoken Sep 25 at 10:49
  • a single style with min and max scaledenominators will be sufficient - no need for a layer group – Ian Turton Sep 25 at 11:32
  • 1
    i am not sure how it's possible through a single style. Can you please explain a little bit further.? I've looked into this: docs.geoserver.org/stable/en/user/styling/sld/cookbook/… – Dinesh Neupane Sep 26 at 4:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.