Hi All,
I’m currently trying to put together an SLD style (for WMS use) that will crop a raster coverage layer to the borders of an administrative unit (chosen by id).
This question has been asked in various forms a lot of times before: 1, 2, 3, 4, 5, but never quite got a full working answer.
I have a raster layer/store, and a postgis multipolygon feature collection layer/store. I want to crop the raster by one of the multipolygon selected using a wms parameter.
Here’s what I’ve tried:
-
A style applied to the raster layer, with a static WKT shape.
-
This works, but doesn’t do what i’m looking for (shape not from postgis)
-
The WKT could be provided externally using “env” substitution, but my shapes are far too complex to do this in a HTTP request.
-
A style applied to the raster layer, which uses “gs:Query” to load the vector data and filter.
-
This doesn’t work as there doesn’t seems to be a way to specify the name of the layer/store from which to load a feature collection.
-
A style applied to the vector layer, with a cql_filter to select only a single multipolygon, which uses “gs:GetFullCoverage” to load the raster data
-
This almost works, it crashes at run time. Is it treating a mutipolygon as a polygon maybe?
-
org.postgresql.util.PSQLException: ERROR: parse error - invalid geometry Hint: “POLYGON ((-?” ← parse error at position 12 within geometry, at org.geotools.process.function.ProcessFunction.evaluate
-
I think there is probably a way to make this approach work, (gs:GetFullCoverage work with static WKT)
-
SLD 3
There is clearly demand of this functionality, so it would be good to get a working example of this into the official documentation (@ User Manual » Styling » SLD Extensions in GeoServer » Rendering Transformations).
Anyone have any idea how I can get this to work?
Rob