[GIS] Clipping a Geoserver raster layer with a polygon

clipgeoserverwcswfswms

I have an image mosaic raster layer with an extent that covers the contiguous United States. I also have a wfs layer with various polygons some covering subsets of the US and some outside of the US.

Essentially I'd like to have a request that returns a clipped version of the raster using one of these polygon.

As an attempt to do this I've installed the cross layer filtering extension

The following query either returns the entire raster or none of it based on if any part of the entire geometry of the raster intersects the polygon.

http://geoserverinstance/geoserver/wms?&layers=gdd:agdd&styles=gdd:agdd_web,&FORMAT=image/png&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&EXCEPTIONS=application/vnd.ogc.se_inimage&SRS=EPSG:4269&CQL_FILTER=INTERSECTS(the_geom, querySingle('gdd:redmaple', 'geom', 'gid=1'))&bbox=-125.020833333333,24.0625,-66.479166666662,49.937500000002&width=1600&height=800

In the query I just pass "the_geom" for the raster layer. Is there a way for it to do the intersection on a pixel by pixel basis masking out the pixels that don't intersect?

Is it not possible to do this clipping activity using this extension? I know there is also a wps extension that might do it, but I've had issues installing it. So if this won't work I can go back to trying to figure those issues out.

Best Answer

Cross layer filtering does indeed work only for vector features. You can try your luck with the Crop process. There is no documentation on how to use it as a rendering transformation, but its direct WPS usage looks like it could be a match for your requiements: http://geoserver.geo-solutions.it/edu/en/wps/chaining_processes.html