Hello,

I am trying to get a SLD style to render three bands raster using SLD
variable substitution (env)

At the moment I get it work with:
<?xml version="1.0" encoding="ISO-8859-1"?>
<StyledLayerDescriptor version="1.0.0" 
 xsi:schemaLocation="http://www.opengis.net/sld StyledLayerDescriptor.xsd" 
 xmlns="http://www.opengis.net/sld"; 
 xmlns:ogc="http://www.opengis.net/ogc"; 
 xmlns:xlink="http://www.w3.org/1999/xlink"; 
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
  
  <NamedLayer>
    <Name>sentinel1</Name>
    <UserStyle>
    
      <Title>sentinel1</Title>
      <Abstract>A sample style that draws a raster, good for displaying
imagery</Abstract>
      
      
      <FeatureTypeStyle>
        
        <Rule>
          <Name>nolabel</Name>
          <Title>Opaque Raster</Title>
          <Abstract>A raster with 100% opacity</Abstract>
         <RasterSymbolizer>
        <Opacity>1.0</Opacity>
<ChannelSelection>
  <RedChannel>
    <SourceChannelName>1</SourceChannelName>
   <ContrastEnhancement>
        <Normalize>
         <VendorOption name="algorithm">
           <ogc:Function name="env">
                 <ogc:Literal>algorithm</ogc:Literal>
                 <ogc:Literal>StretchToMinimumMaximum</ogc:Literal>
           </ogc:Function>
         </VendorOption>
         <VendorOption name='minValue'>
           <ogc:Function name="env">
                 <ogc:Literal>low1</ogc:Literal>
                 <ogc:Literal>0</ogc:Literal>
           </ogc:Function>
         </VendorOption>
         <VendorOption name='maxValue'>
           <ogc:Function name="env">
                 <ogc:Literal>high1</ogc:Literal>
                 <ogc:Literal>0.013</ogc:Literal>
           </ogc:Function>
         </VendorOption>
        </Normalize>
</ContrastEnhancement>
  </RedChannel>
  <GreenChannel>
    <SourceChannelName>2</SourceChannelName>
    <ContrastEnhancement>
        <Normalize>
         <VendorOption name="algorithm">
           <ogc:Function name="env">
                 <ogc:Literal>algorithm</ogc:Literal>
                 <ogc:Literal>StretchToMinimumMaximum</ogc:Literal>
           </ogc:Function>
         </VendorOption>
         <VendorOption name='minValue'>
           <ogc:Function name="env">
                 <ogc:Literal>low2</ogc:Literal>
                 <ogc:Literal>0</ogc:Literal>
           </ogc:Function>
         </VendorOption>
         <VendorOption name='maxValue'>
           <ogc:Function name="env">
                 <ogc:Literal>high2</ogc:Literal>
                 <ogc:Literal>0.093</ogc:Literal>
           </ogc:Function>
         </VendorOption>
        </Normalize>
</ContrastEnhancement>                
  </GreenChannel>
 <BlueChannel>
    <SourceChannelName>3</SourceChannelName>
   <ContrastEnhancement>
        <Normalize>
         <VendorOption name="algorithm">
           <ogc:Function name="env">
                 <ogc:Literal>algorithm</ogc:Literal>
                 <ogc:Literal>StretchToMinimumMaximum</ogc:Literal>
           </ogc:Function>
         </VendorOption>
         <VendorOption name='minValue'>
           <ogc:Function name="env">
                 <ogc:Literal>low3</ogc:Literal>
                 <ogc:Literal>10</ogc:Literal>
           </ogc:Function>
         </VendorOption>
         <VendorOption name='maxValue'>
           <ogc:Function name="env">
                 <ogc:Literal>high3</ogc:Literal>
                 <ogc:Literal>1600</ogc:Literal>
           </ogc:Function>
         </VendorOption>
        </Normalize>
</ContrastEnhancement> 
  </BlueChannel>
           </ChannelSelection>
</RasterSymbolizer>
        </Rule>
      </FeatureTypeStyle>
    </UserStyle>
  </NamedLayer>
</StyledLayerDescriptor>


The problem is that I have to specify three "low" and "high" env values
which is a bit of a hassle...

I want to normalize values of high1 and high2 based on high3 using something
similar as in SLD colormap ( <ogc:Literal>${env('high1', 'low1') /
env('high3', 1600)/10000}</ogc:Literal> )

Is tried this way but still have not it working:

<?xml version="1.0" encoding="ISO-8859-1"?>
<StyledLayerDescriptor version="1.0.0" 
 xsi:schemaLocation="http://www.opengis.net/sld StyledLayerDescriptor.xsd" 
 xmlns="http://www.opengis.net/sld"; 
 xmlns:ogc="http://www.opengis.net/ogc"; 
 xmlns:xlink="http://www.w3.org/1999/xlink"; 
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
  
  <NamedLayer>
    <Name>sentinel1</Name>
    <UserStyle>
    
      <Title>sentinel1</Title>
      <Abstract>A sample style that draws a raster, good for displaying
imagery</Abstract>
      
      
      <FeatureTypeStyle>
        
        <Rule>
          <Name>nolabel</Name>
          <Title>Opaque Raster</Title>
          <Abstract>A raster with 100% opacity</Abstract>
         <RasterSymbolizer>
        <Opacity>1.0</Opacity>
<ChannelSelection>
  <RedChannel>
    <SourceChannelName>1</SourceChannelName>
   <ContrastEnhancement>
        <Normalize>
         <VendorOption name="algorithm">
           <ogc:Function name="env">
                 <ogc:Literal>algorithm</ogc:Literal>
                 <ogc:Literal>StretchToMinimumMaximum</ogc:Literal>
           </ogc:Function>
         </VendorOption>
         <VendorOption name='minValue'>
           <ogc:Function name="env">                    
                 <ogc:Literal>low1</ogc:Literal>
                 <ogc:Literal>0</ogc:Literal>
           </ogc:Function>
         </VendorOption>
         <VendorOption name='maxValue'>
           <ogc:Function name="env">              
                <ogc:Literal>high1</ogc:Literal>
                 <ogc:Literal>${env('high1', 'low1') / env('high3',
1600)/10000}</ogc:Literal>     
           </ogc:Function>
         </VendorOption>
        </Normalize>
</ContrastEnhancement>
  </RedChannel>
  <GreenChannel>
    <SourceChannelName>2</SourceChannelName>
    <ContrastEnhancement>
        <Normalize>
         <VendorOption name="algorithm">
           <ogc:Function name="env">
                 <ogc:Literal>algorithm</ogc:Literal>
                 <ogc:Literal>StretchToMinimumMaximum</ogc:Literal>
           </ogc:Function>
         </VendorOption>
         <VendorOption name='minValue'>
           <ogc:Function name="env">
                 <ogc:Literal>low2</ogc:Literal>
                 <ogc:Literal>0</ogc:Literal>
           </ogc:Function>
         </VendorOption>
         <VendorOption name='maxValue'>
           <ogc:Function name="env">
               <ogc:Literal>high2</ogc:Literal>                 
                 <ogc:Literal>${env('high2', 'low2') / env('high3',
1600)/10000}</ogc:Literal>    
           </ogc:Function>
         </VendorOption>
        </Normalize>
</ContrastEnhancement>                
  </GreenChannel>
 <BlueChannel>
    <SourceChannelName>3</SourceChannelName>
   <ContrastEnhancement>
        <Normalize>
         <VendorOption name="algorithm">
           <ogc:Function name="env">
                 <ogc:Literal>algorithm</ogc:Literal>
                 <ogc:Literal>StretchToMinimumMaximum</ogc:Literal>
           </ogc:Function>
         </VendorOption>
         <VendorOption name='minValue'>
           <ogc:Function name="env">
                 <ogc:Literal>low3</ogc:Literal>
                 <ogc:Literal>10</ogc:Literal>
           </ogc:Function>
         </VendorOption>
         <VendorOption name='maxValue'>
           <ogc:Function name="env">
                 <ogc:Literal>high3</ogc:Literal>
                 <ogc:Literal>1600</ogc:Literal>
           </ogc:Function>
         </VendorOption>
        </Normalize>
</ContrastEnhancement> 
  </BlueChannel>
           </ChannelSelection>
</RasterSymbolizer>
        </Rule>
      </FeatureTypeStyle>
    </UserStyle>
  </NamedLayer>
</StyledLayerDescriptor>


Many thanks!

Alberto





--
View this message in context: 
http://osgeo-org.1560.x6.nabble.com/Dynamic-Styling-three-bands-raster-tp5326744.html
Sent from the GeoServer - User mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Geoserver-users mailing list

Please make sure you read the following two resources before posting to this 
list:
- Earning your support instead of buying it, but Ian Turton: 
http://www.ianturton.com/talks/foss4g.html#/
- The GeoServer user list posting guidelines: 
http://geoserver.org/comm/userlist-guidelines.html

[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to