1

How can I clip a WMS layer based on the geometries of another layer?

My first layer is an Image WMS that exposes a raster and the second is a vector layer that exposes some polygons. I want, if it is possible to show only the parts of raster that are within the polygons. (note: I want to clip only the specific layer, not my basemap layer.)

2
  • Can you illustrate what you mean by clipping a WMS layer/image? By showing only the parts of image that are within the polygons, do you man obscure the rest, or are you after transparency to see lower levels, or something else? Does the WMS accept SLD as part of a GetMap request? Does the polygon layer share any attributes from the underlying WMS data source you could filter on?
    – nmtoken
    Commented Apr 6, 2018 at 18:53
  • Hi, yes I want to show only the parts of the image that are within the polygons and to apply a transparency to the rest in order to see the lower layers. No, my wms doesn't accept sld and the two layers haven't any relationship... Commented Apr 6, 2018 at 21:28

1 Answer 1

2

Finnaly, the solution is using crop/mask filter from http://viglino.github.io/ol-ext/ !

See this example http://viglino.github.io/ol-ext/examples/filter/map.filter.crop.html

1
  • It would be great if you could explain how it works, at the moment you have a link only answer.
    – nmtoken
    Commented Apr 7, 2018 at 18:54

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.