I have a big set of GeoTIFF files being served by GeoServer. All the styles are previously generated and then posted through GeoServer REST API.
Then I need to send color and quantity parameters to those SLD files which I managed to accomplish using ENV request. So far so good.
The problem is now we will be getting specific user input for these parameters and the number of ColorMapEntry classes may vary.
For example:
<?xml version="1.0" encoding="UTF-8"?>
<StyledLayerDescriptor xmlns="http://www.opengis.net/sld" xmlns:ogc="http://www.opengis.net/ogc" xmlns:gml="http://www.opengis.net/gml" version="1.0.0" xmlns:sld="http://www.opengis.net/sld">
<UserLayer>
<sld:LayerFeatureConstraints>
<sld:FeatureTypeConstraint/>
</sld:LayerFeatureConstraints>
<sld:UserStyle>
<sld:Name>Interpolated (IDW with NN search)</sld:Name>
<sld:FeatureTypeStyle>
<sld:Rule>
<sld:RasterSymbolizer>
<sld:ChannelSelection>
<sld:GrayChannel>
<sld:SourceChannelName>1</sld:SourceChannelName>
</sld:GrayChannel>
</sld:ChannelSelection>
<sld:ColorMap type="ramp">
<sld:ColorMapEntry quantity="${env('q0',0)}" label="0,0" color="${env('c0','#01ff05')}"/>
<sld:ColorMapEntry quantity="${env('q1',0.2)}" label="0,2" color="${env('c1','#ffff0')}"/>
<sld:ColorMapEntry quantity="${env('q2',0.5)}" label="0,5" color="${env('c2','#ff8400')}"/>
<sld:ColorMapEntry quantity="${env('q3',2)}" label="2,0" color="${env('c3','#ff0000')}"/>
</sld:ColorMap>
</sld:RasterSymbolizer>
</sld:Rule>
</sld:FeatureTypeStyle>
</sld:UserStyle>
</UserLayer>
</StyledLayerDescriptor>
Here I can pass parameters via HTTP without any problems. But what if for this specific SLD file I have 6 ColorMapEntry classes? Is there a way I can tell GeoServer to dynamically generate these classes without having to previously parse a whole new SLD/XML file?