Dynamic SLD Name and Title using Geosever

43 Views Asked by At

We are trying to make dynamic sld where color pallets will be created according to env parameter passed to sld, and get Legend for the same using getLegendGraphichs of geoserver but with no success, is it possible to get Name and Title section of sld also get updated dynamically according to env parameters, if not is there other alternatives?

enter image description here

Our thought is that if some how we are passing env parameter to title then we will get the updated title of legend

This the env string we are passing to openlayers wms request ENV=class1:38.81;class2:42.82;class3:46.82;class4:50.83;class5:54.83;class6:58.84;class7:62.84

<se:Rule>
  <se:Name>0.1 - 
     <!-- "2nd Name should be taken from env parameter" -->
      <ogc:Function name="env">
        <ogc:Literal>class1</ogc:Literal>
        <!-- "below line for default one" -->
        <ogc:Literal>48.78</ogc:Literal>
      </ogc:Function>
  </se:Name>
  <se:Description>
    <se:Title> 0.1 - 
     <!-- "2nd Title should be taken from env parameter" -->
      <ogc:Function name="env">
        <ogc:Literal>class1</ogc:Literal>
        <!-- "below line for default one" -->
        <ogc:Literal>48.78</ogc:Literal>
      </ogc:Function>            
    </se:Title>
  </se:Description>
  <ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
    <ogc:And>
      <ogc:PropertyIsGreaterThan>
        <ogc:PropertyName>wght_indx</ogc:PropertyName>
        <ogc:Literal>0.1</ogc:Literal>
      </ogc:PropertyIsGreaterThan>
      <ogc:PropertyIsLessThanOrEqualTo>
        <ogc:PropertyName>wght_indx</ogc:PropertyName>
        <!-- "This is working when we pass env parameter" -->
        <ogc:Function name="env">
          <ogc:Literal>class1</ogc:Literal>
          <ogc:Literal>48.78</ogc:Literal>
        </ogc:Function>
      </ogc:PropertyIsLessThanOrEqualTo>
    </ogc:And>
  </ogc:Filter>
  <se:PolygonSymbolizer>
    <se:Fill>
      <se:SvgParameter name="fill">#ade6ce</se:SvgParameter>
    </se:Fill>
    <se:Stroke>
      <se:SvgParameter name="stroke">#232323</se:SvgParameter>
      <se:SvgParameter name="stroke-width">1</se:SvgParameter>
      <se:SvgParameter name="stroke-linejoin">bevel</se:SvgParameter>
    </se:Stroke>
  </se:PolygonSymbolizer>
</se:Rule>

0

There are 0 best solutions below