I have more than 400 users, each has its own layer view area on the map, I was able to implement this using Geofence, I added layers to the layer group in GeoServer, and configured roles in Geofence for users. In GeoServer in the "View layers" everything works well and all layers are displayed correctly in their territories.

But when I open my site with a map built on the Leaflet plugin, the WMS layers are displayed correctly, and the WFS layers are not displayed as expected, they are displayed on the entire map. For WFS layers I use the Leaflet-WFST plugin. How can I make WFS layers display correctly with a territory limit how it works with WMS layers?

Edit: I think the problem is not in my code, because if the WFS layer is made separately from the layer group and set to WKT, then the territory restrictions will work on the web page. But this option is not suitable, since I will need to duplicate this stand so many times with other WKTs, and I also have a lot of vector layers and they will also have to be duplicated, which is why I made a group of layers. So that you can implement this on your own, just add layers to Geoserver, then to a layer group and try to display it on a WEB map (not in Geoserver), and you can take the base code from the Leaflet-WFST plugin. Geoserver 2.20.4

Who needs it, I use this code for WFS:

var boundaries = new L.WFS({
    url: 'http://localhost:8080/geoserver/wfs',
    typeNS: 'cite',
    typeName: 'layerWFS',
    crs: L.CRS.EPSG4326,
        showExisting: true,
        geometryField: 'lin',
    style: {
        color: 'red',
        weight: 2

map Geoserver map web

Edit2: I figured out that layer groups can't include WFS layers, but now with a layer group there are only 237 rules in geofence. This means that my 23 WFS layers that are not included in these 237 rules will need to be written separately, which means that I will have to write +5451 more rules for WFS layers. Is there any way to use WFS layers in a layer group?

  • 1
    Coding question on GIS SE site should include relevant existing code, otherwise it's most likely to be closed as not compliant with the site policy. Please edit your question and add relevant existing code.
    – TomazicM
    Jun 17, 2022 at 7:50
  • 1
    Welcome to GIS SE! We're a little different from other sites; this isn't a discussion forum but a Q&A site. Your questions should as much as possible describe not just what you want to do, but precisely what you have tried and where you are stuck trying that. Please check out our short tour for more about how the site works
    – Ian Turton
    Jun 17, 2022 at 9:25
  • 2
    did you set rules for the WFS service as well as the WMS?
    – Ian Turton
    Jun 17, 2022 at 9:26
  • @IanTurton yes.
    – zetsuMetsu
    Jun 21, 2022 at 6:43
  • can you add a screen shot of your map, and is you map in 4326?
    – Ian Turton
    Jun 21, 2022 at 8:00


Your Answer

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

Browse other questions tagged or ask your own question.