Hi there,

for the benefit of the list.. it is indeed possible, but you need to pay 
attention to the "NamedLayer", unlike for a normal sld its name must match your 
layer name (I recall this now from years ago as a way of defining which layer 
in your request this sld applies to)

so the sld is:

<StyledLayerDescriptor version="1.0.0">
  <NamedLayer>
    <Name>ACTUAL_LAYER_NAME_HERE</Name>
    <UserStyle>
      <FeatureTypeStyle>
        <Rule>
          <Name>rule1</Name>
          <RasterSymbolizer>
            <ChannelSelection>
              <RedChannel>
                <SourceChannelName>1</SourceChannelName>
             </RedChannel>
              <GreenChannel>
                <SourceChannelName>1</SourceChannelName>
              </GreenChannel>
              <BlueChannel>
                <SourceChannelName>3</SourceChannelName>
              </BlueChannel>
            </ChannelSelection>
          </RasterSymbolizer>
        </Rule>
      </FeatureTypeStyle>
    </UserStyle>
  </NamedLayer>
</StyledLayerDescriptor>

with contrast enhancement:
<StyledLayerDescriptor version="1.0.0">
  <NamedLayer>
    <Name>ACTUAL_LAYER_NAME_HERE</Name>
    <UserStyle>
      <FeatureTypeStyle>
        <Rule>
          <Name>rule1</Name>
          <RasterSymbolizer>
            <ChannelSelection>
              <RedChannel>
                <SourceChannelName>1</SourceChannelName>
                <ContrastEnhancement>
                  <Histogram />
                  <GammaValue>1</GammaValue>
                </ContrastEnhancement>
              </RedChannel>
              <GreenChannel>
                <SourceChannelName>1</SourceChannelName>
                <ContrastEnhancement>
                  <Histogram />
                  <GammaValue>1</GammaValue>
                </ContrastEnhancement>
              </GreenChannel>
              <BlueChannel>
                <SourceChannelName>3</SourceChannelName>
                <ContrastEnhancement>
                  <Histogram />
                  <GammaValue>1</GammaValue>
                </ContrastEnhancement>
              </BlueChannel>
            </ChannelSelection>
          </RasterSymbolizer>
        </Rule>
      </FeatureTypeStyle>
    </UserStyle>
  </NamedLayer>
</StyledLayerDescriptor>



De : Ivan Price [mailto:[email protected]]
Envoyé : lundi 2 avril 2012 17:03
À : [email protected]
Objet : [Geoserver-users] raster symbolizer wms using dynamic SLD


Hi there,

I have an SLD for choosing 3 bands of a multi band image and allocating them to 
particular R,G,B channels as per the doc (sld is included below).

This works excellently when the SLD is pre-defined in the geoserver config 
(using style=) however I would like to define which bands are to be r,g,b  
(i.e. the 'SourceChannelName') at the time of the request.

I have seen on this list that that using the 'env' parameter is not possible, 
but it seems that using the SLD=<url> and SLD_BODY=<xml> params are also not 
possible, as geoserver seems to ignore their content for raster data (unless it 
is malformed in which case it throws an error).

Does anybody know if I am doing something wrong ?

thanks and cheers,

-ivan




<?xml version="1.0" encoding="ISO-8859-1"?>
<StyledLayerDescriptor version="1.0.0"
 xsi:schemaLocation="http://www.opengis.net/sld 
StyledLayerDescriptor.xsd<http://www.opengis.net/sld%20StyledLayerDescriptor.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>rgb_raster</Name>
    <UserStyle>
      <Title>rgb Raster</Title>
      <FeatureTypeStyle>
        <Rule>
          <Name>rule1</Name>
          <Title>Opaque Raster</Title>
          <Abstract>A raster with 100% opacity</Abstract>
          <RasterSymbolizer>

            <ChannelSelection>
              <RedChannel>
                <SourceChannelName>1</SourceChannelName>
              </RedChannel>

              <GreenChannel>
                <SourceChannelName>2</SourceChannelName>
              </GreenChannel>

              <BlueChannel>
                <SourceChannelName>3</SourceChannelName>
              </BlueChannel>
            </ChannelSelection>

          </RasterSymbolizer>
        </Rule>
      </FeatureTypeStyle>
    </UserStyle>
  </NamedLayer>
</StyledLayerDescriptor>
------------------------------------------------------------------------------
Better than sec? Nothing is better than sec when it comes to
monitoring Big Data applications. Try Boundary one-second 
resolution app monitoring today. Free.
http://p.sf.net/sfu/Boundary-dev2dev
_______________________________________________
Geoserver-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to