0

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.)

  • 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 Apr 6 '18 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... – Συμεών Τασκάρης Apr 6 '18 at 21:28
1

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

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

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.