Is it possible to mask raster layer by features from vector layer in GeoServer? I want dynamic connection, so adding a new feature to the vector layer will automatically change the raster layer mask.

Right now I managed to create an SLD for a raster layer that overlays vector features over the raster:

enter image description here

But I want proper cut-out areas, like this one:

enter image description here

1 Answer 1


No, that's currently not possible. You can get something similar but setting up the GeoFence extension and managing its rules, which include cutting rasters over polygons.

GeoFence has a REST API that you can use to automate rule management, too.

If you really want to use a spatial table instead, you can write your own ResourceAccessManager implementation, that does the specific kind of security you want (even in case you don't really care about who's the current user, and you just want to cut things).

Or you can implement your own rendering transformation, that will fetch from the table and cut rasters on the fly (you'll have to invoke it from the SLDs to work, users might bypass it by choosing a different style).

If none of the above suits you, check out https://geoserver.org/support/

  • Hi Andrea, Thankyou for quick reply!
    – dmtflmnv
    May 20, 2022 at 4:45

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.