Hi, By searching through the users mailinglist i found the solution to the problem described below, where the env-function behaves strange.
I enhanced the documentation to help others having the same issue via this PR: https://github.com/geoserver/geoserver/pull/5277 I am still interested in your opinions regarding acces to any query parameter through the env function. Possible addition in RenderingVariables.class: Map<String, String> kvp = mapContent.getRequest().getRawKvp(); kvp.keySet() .forEach( k -> {EnvFunction.setLocalValue(k, kvp.get(k)); }); Greets, Johannes Am 07.09.21 um 13:29 schrieb Johannes Weskamm: > > Hi List, > > > I am currently trying to specify an external graphic in my SLD using > variables - making it dynamic. > > <OnlineResource xlink:type="simple" > xlink:href="https://mydomain.com/get/${grid_id}/${env(time)}/2007-12-31T23:00:00.000Z/10.svg" > /> > > The idea is to make use of URL parameters. I have a time enabled WMS, > thus the "TIME" parameter is contained in the URL. > > I want to access the time parameter and add it to my URL. Problem is, > that only 5 predefined query parameters / calculations can be used in > SLD as described in the variable substitution documentation via the > env function (e.g. "wms_bbox"). Besides, using the env function in the > "xlink:href" attribute of the external graphic seems to be unsupported > or broken, as GeoServer tries to find the given env attribute on the > layer, which obviously does not exist, and fails with: > > > "The requested Style can not be used with this layer. The style > specifies an attribute named 'time', not found in the topp:test > layer". So i would like to accomplish two things and ask for your > opinions: * Allow adding all query params to the RenderingVariables > class (src/main/java/org/geoserver/wms/RenderingVariables.java) or at > least some obviously missing ones like time * Get the env function > working in this specific place Any opinions / objections on this? > Maybe security is an issue when simply adding all query parameters to > the rendering variables. Greetings, Johannes > > > _______________________________________________ > Geoserver-devel mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/geoserver-devel
_______________________________________________ Geoserver-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/geoserver-devel
