Replies: 3 comments 3 replies
-
The slack channel is better for these kind of questions, but I'm not sure I fully understand the requirements. |
Beta Was this translation helpful? Give feedback.
-
This is a feature I would also be very much interested in, and would like to help to implement - but would likely need support in understanding how MapLibre works. Use caseI'm not sure if my use case is the same as what @cotegeo has in mind but we've been rendering Cloud Optimised GeoTiffs to a raster layer using @geomatico/maplibre-cog-protocol. We have functionality where we only want to render data within user selected country boundaries, but because the COG has data for the whole world we want a mask layer above the COG layer to hide everything but the selected countries.
Masking via a custom layerI recently managed to create a proof of concept masking layer that implements CustomLayerInterface. It's quite a rudimentary solution that only works with mercator projection, but it would be great to have this natively supported as I think it could run much more efficiently and maybe also support globe projection. The custom layer:
There is example code in this discussion where I was struggling with the stencil buffer but then found a fudge to fix the rendering issues that I won't bother duplicating here, but when I was bumbling around ProposalAs @cotegeo mentioned, I think it would be good to add a This would be good as theoretically the masking could work with a VectorTileSource or GeoJSON source and even use filter expressions to pick what is not masked out. Potential issuesThe issue with this approach is that the mask is just a painted colour so if you had raster tiles below as your base map they would be hidden too. Alternative approachMaybe a better solution would be to add masking to raster layers to only paint the pixels of the raster within the provided polygons, but I have no idea if that is even possible, and if being able to provide raster layer with a vector source to mask with alongside the raster source would be messy. Although I am keen to help add functionality like this I wouldn't even know where to start or what the best approach to take would be, but I am happy to try figure it out with some guidance 😊 |
Beta Was this translation helpful? Give feedback.
-
Is this a dynamic change you need to do? Otherwise you could:
|
Beta Was this translation helpful? Give feedback.
-
Good morning,
I'd like to put a mask layer on my app. I saw on a forum it exists a property 'fill-region' with values 'inside' and "outside". But this doesn't work. The console returns "unknown property". Is there a property that enable to make mask ?
Thanks
Sylvain BECQUAERT
Beta Was this translation helpful? Give feedback.
All reactions