[Geoserver-users] Opacity in ColorMap

Hello,

I'm looking to use an SLD in GeoServer 1.5.3. to display a GeoTIFF, with an opacity based on its seperate colors. For example, any color darker than #7F7F7F (grey) will have an opacity of 0.0, while anything lighter, will have a full opacity of 1.0. (Attempting to show clouds).

I've attempted to change the standard 'raster' SLD in as many ways possible, to no avail. I'm wondering if it is even possible for GeoServer to support opacity based on different colors, or if I'm just not yet familiar enough with GeoTIFFS to make it happen.

The gdalinfo for the GeoTIFF I am using:

Driver: GTiff/GeoTIFF
Files: test.tif
Size is 9000, 4500
Coordinate System is:
PROJCS["TeraScan Export",
    GEOGCS["Spherical Earth",
        DATUM["unknown",
            SPHEROID["unnamed",6378137,0]],
        PRIMEM["Greenwich",0],
        UNIT["degree",0.0174532925199433]],
    PROJECTION["Equirectangular"],
    PARAMETER["latitude_of_origin",0],
    PARAMETER["central_meridian",0],
    PARAMETER["false_easting",0],
    PARAMETER["false_northing",0],
    UNIT["metre",1,
        AUTHORITY["EPSG","9001"]]]
Origin = (-20035281.952973376959562,10016527.781578756868839)
Pixel Size = (4452.779631730943038,-4452.779631730943038)
Metadata:
  AREA_OR_POINT=Point
  TIFFTAG_IMAGEDESCRIPTION=DATA_PLATFORM="noaa-17";DATA_NAME="ir";DATA_START_TIME="Wed, 12 Sep 2007 11:51:33 GMT";DATA_END_TIME="Wed, 12 Sep 2007 13:50:47 GMT";DATA_UNITS="celsius";DATA_RANGE="0,249,-100,0.60241,None";
  TIFFTAG_SOFTWARE=TeraScan
  TIFFTAG_DATETIME=2007/09/12 10:51:33
Corner Coordinates:
Upper Left (-20035281.953,10016527.782) (179d58'48.00"W, 89d58'48.00"N)
Lower Left (-20035281.953,-10020980.561) (179d58'48.00"W, 90d 1'12.00"S)
Upper Right (20039734.733,10016527.782) (179d58'48.00"W, 89d58'48.00"N)
Lower Right (20039734.733,-10020980.561) (179d58'48.00"W, 90d 1'12.00"S)
Center ( 2226.390, -2226.390) ( 0d 1'12.00"E, 0d 1'12.00"S)
Band 1 Block=9000x1 Type=Byte, ColorInterp=Palette
  Color Table (RGB with 256 entries)
    0: 255,255,255,255
    1: 254,254,254,255
    2: 254,254,254,255
    3: 253,253,253,255
    4: 253,253,253,255
    5: 252,252,252,255
    6: 252,252,252,255
    7: 251,251,251,255
    8: 251,251,251,255
    9: 250,250,250,255
   10: 250,250,250,255
   11: 249,249,249,255
   12: 249,249,249,255
   13: 248,248,248,255
   14: 248,248,248,255
   15: 247,247,247,255
   16: 247,247,247,255
   17: 246,246,246,255
   18: 246,246,246,255
   19: 245,245,245,255
   20: 245,245,245,255
   21: 244,244,244,255
   22: 243,243,243,255
   23: 243,243,243,255
   24: 242,242,242,255
   25: 242,242,242,255
   26: 241,241,241,255
   27: 241,241,241,255
   28: 240,240,240,255
   29: 240,240,240,255
   30: 239,239,239,255
  
   ...
  225: 80,80,80,255
  226: 78,78,78,255
  227: 76,76,76,255
  228: 75,75,75,255
  229: 71,71,71,255
  230: 69,69,69,255
  231: 67,67,67,255
  232: 65,65,65,255
  233: 64,64,64,255
  234: 61,61,61,255
  235: 59,59,59,255
  236: 57,57,57,255
  237: 55,55,55,255
  238: 53,53,53,255
  239: 50,50,50,255
  240: 48,48,48,255
  241: 45,45,45,255
  242: 42,42,42,255
  243: 39,39,39,255
  244: 35,35,35,255
  245: 32,32,32,255
  246: 27,27,27,255
  247: 22,22,22,255
  248: 16,16,16,255
  249: 0,0,0,255
  250: 255,255,255,255
  251: 0,0,0,255
  252: 255,255,0,255
  253: 0,0,0,255
  254: 0,0,0,255
  255: 0,0,0,255

The SLD I'm using:

<?xml version="1.0" encoding="UTF-8"?>
<StyledLayerDescriptor 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 " xsi:schemaLocation="http://www.opengis.net/sld
http://schemas.opengis.net/sld/1.0.0/StyledLayerDescriptor.xsd " version="1.0.0">
<UserLayer>
  <Name>raster_layer</Name>
        <LayerFeatureConstraints>
            <FeatureTypeConstraint/>
        </LayerFeatureConstraints>
  <UserStyle>
    <Name>raster</Name>
    <Title>A boring default style</Title>
    <Abstract>A sample style for rasters</Abstract>
    <FeatureTypeStyle>
          <FeatureTypeName>Feature</FeatureTypeName>
      <Rule>
        <RasterSymbolizer>
            <Opacity>1.0</Opacity>
            <OverlapBehavior>
               <AVERAGE/>
            </OverlapBehavior>
            <ColorMap>
               <ColorMapEntry color="#000000" quantity="-500" label="nodata" opacity="0.0"/>
               <ColorMapEntry color="#00ff00" quantity="-500" label="values"/>
               <ColorMapEntry color="#00fa00" quantity="-417" label="values"/>
               <ColorMapEntry color="#14f500" quantity="-333" label="values"/>
               <ColorMapEntry color="#28f502" quantity="-250" label="values"/>
               <ColorMapEntry color="#3cf505" quantity="-167" label="values"/>
               <ColorMapEntry color="#50f50a" quantity="-83" label="values"/>
               <ColorMapEntry color="#64f014" quantity="-1" label="values"/>
               <ColorMapEntry color="#7deb32" quantity="0" label="values"/>
               <ColorMapEntry color="#78c818" quantity="30" label="values"/>
               <ColorMapEntry color="#38840c" quantity="105" label="values"/>
               <ColorMapEntry color="#2c4b04" quantity="300" label="values"/>
               <ColorMapEntry color="#ffff00" quantity="400" label="values"/>
               <ColorMapEntry color="#dcdc00" quantity="700" label="values"/>
               <ColorMapEntry color="#b47800" quantity="1200" label="values"/>
               <ColorMapEntry color="#c85000" quantity="1400" label="values"/>
               <ColorMapEntry color="#be4100" quantity="1600" label="values"/>
               <ColorMapEntry color="#963000" quantity="2000" label="values"/>
               <ColorMapEntry color="#3c0200" quantity="3000" label="values"/>
               <ColorMapEntry color="#ffffff" quantity="5000" label="values"/>
               <ColorMapEntry color="#ffffff" quantity="13000" label="values"/>
            </ColorMap>
            <ShadedRelief/>
        </RasterSymbolizer>
      </Rule>
    </FeatureTypeStyle>
  </UserStyle>
</UserLayer>
</StyledLayerDescriptor>

Thanks,

-Sam

Hi Sam:

Geoserver's raster symbolizer is not implemented yet--that means that
the GeoTIFF will have to have a predefined alpha channel (with its
values set) prior to using it as a coverage in Geoserver.

Alex

On 9/24/07, Samuel Toepke <SToepke@anonymised.com> wrote:

Hello,

I'm looking to use an SLD in GeoServer 1.5.3. to display a GeoTIFF, with an opacity based on its seperate colors. For example, any color darker than #7F7F7F (grey) will have an opacity of 0.0, while anything lighter, will have a full opacity of 1.0. (Attempting to show clouds).

I've attempted to change the standard 'raster' SLD in as many ways possible, to no avail. I'm wondering if it is even possible for GeoServer to support opacity based on different colors, or if I'm just not yet familiar enough with GeoTIFFS to make it happen.

The gdalinfo for the GeoTIFF I am using:

Driver: GTiff/GeoTIFF
Files: test.tif
Size is 9000, 4500
Coordinate System is:
PROJCS["TeraScan Export",
    GEOGCS["Spherical Earth",
        DATUM["unknown",
            SPHEROID["unnamed",6378137,0]],
        PRIMEM["Greenwich",0],
        UNIT["degree",0.0174532925199433]],
    PROJECTION["Equirectangular"],
    PARAMETER["latitude_of_origin",0],
    PARAMETER["central_meridian",0],
    PARAMETER["false_easting",0],
    PARAMETER["false_northing",0],
    UNIT["metre",1,
        AUTHORITY["EPSG","9001"]]]
Origin = (-20035281.952973376959562,10016527.781578756868839)
Pixel Size = (4452.779631730943038,-4452.779631730943038)
Metadata:
  AREA_OR_POINT=Point
  TIFFTAG_IMAGEDESCRIPTION=DATA_PLATFORM="noaa-17";DATA_NAME="ir";DATA_START_TIME="Wed, 12 Sep 2007 11:51:33 GMT";DATA_END_TIME="Wed, 12 Sep 2007 13:50:47 GMT";DATA_UNITS="celsius";DATA_RANGE="0,249,-100,0.60241,None";
  TIFFTAG_SOFTWARE=TeraScan
  TIFFTAG_DATETIME=2007/09/12 10:51:33
Corner Coordinates:
Upper Left (-20035281.953,10016527.782) (179d58'48.00"W, 89d58'48.00"N)
Lower Left (-20035281.953,-10020980.561) (179d58'48.00"W, 90d 1'12.00"S)
Upper Right (20039734.733,10016527.782) (179d58'48.00"W, 89d58'48.00"N)
Lower Right (20039734.733,-10020980.561) (179d58'48.00"W, 90d 1'12.00"S)
Center ( 2226.390, -2226.390) ( 0d 1'12.00"E, 0d 1'12.00"S)
Band 1 Block=9000x1 Type=Byte, ColorInterp=Palette
  Color Table (RGB with 256 entries)
    0: 255,255,255,255
    1: 254,254,254,255
    2: 254,254,254,255
    3: 253,253,253,255
    4: 253,253,253,255
    5: 252,252,252,255
    6: 252,252,252,255
    7: 251,251,251,255
    8: 251,251,251,255
    9: 250,250,250,255
   10: 250,250,250,255
   11: 249,249,249,255
   12: 249,249,249,255
   13: 248,248,248,255
   14: 248,248,248,255
   15: 247,247,247,255
   16: 247,247,247,255
   17: 246,246,246,255
   18: 246,246,246,255
   19: 245,245,245,255
   20: 245,245,245,255
   21: 244,244,244,255
   22: 243,243,243,255
   23: 243,243,243,255
   24: 242,242,242,255
   25: 242,242,242,255
   26: 241,241,241,255
   27: 241,241,241,255
   28: 240,240,240,255
   29: 240,240,240,255
   30: 239,239,239,255

   ...
  225: 80,80,80,255
  226: 78,78,78,255
  227: 76,76,76,255
  228: 75,75,75,255
  229: 71,71,71,255
  230: 69,69,69,255
  231: 67,67,67,255
  232: 65,65,65,255
  233: 64,64,64,255
  234: 61,61,61,255
  235: 59,59,59,255
  236: 57,57,57,255
  237: 55,55,55,255
  238: 53,53,53,255
  239: 50,50,50,255
  240: 48,48,48,255
  241: 45,45,45,255
  242: 42,42,42,255
  243: 39,39,39,255
  244: 35,35,35,255
  245: 32,32,32,255
  246: 27,27,27,255
  247: 22,22,22,255
  248: 16,16,16,255
  249: 0,0,0,255
  250: 255,255,255,255
  251: 0,0,0,255
  252: 255,255,0,255
  253: 0,0,0,255
  254: 0,0,0,255
  255: 0,0,0,255

The SLD I'm using:

<?xml version="1.0" encoding="UTF-8"?>
<StyledLayerDescriptor 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 " xsi:schemaLocation="http://www.opengis.net/sld
http://schemas.opengis.net/sld/1.0.0/StyledLayerDescriptor.xsd " version="1.0.0">
<UserLayer>
  <Name>raster_layer</Name>
        <LayerFeatureConstraints>
            <FeatureTypeConstraint/>
        </LayerFeatureConstraints>
  <UserStyle>
    <Name>raster</Name>
    <Title>A boring default style</Title>
    <Abstract>A sample style for rasters</Abstract>
    <FeatureTypeStyle>
          <FeatureTypeName>Feature</FeatureTypeName>
      <Rule>
        <RasterSymbolizer>
            <Opacity>1.0</Opacity>
            <OverlapBehavior>
               <AVERAGE/>
            </OverlapBehavior>
            <ColorMap>
               <ColorMapEntry color="#000000" quantity="-500" label="nodata" opacity="0.0"/>
               <ColorMapEntry color="#00ff00" quantity="-500" label="values"/>
               <ColorMapEntry color="#00fa00" quantity="-417" label="values"/>
               <ColorMapEntry color="#14f500" quantity="-333" label="values"/>
               <ColorMapEntry color="#28f502" quantity="-250" label="values"/>
               <ColorMapEntry color="#3cf505" quantity="-167" label="values"/>
               <ColorMapEntry color="#50f50a" quantity="-83" label="values"/>
               <ColorMapEntry color="#64f014" quantity="-1" label="values"/>
               <ColorMapEntry color="#7deb32" quantity="0" label="values"/>
               <ColorMapEntry color="#78c818" quantity="30" label="values"/>
               <ColorMapEntry color="#38840c" quantity="105" label="values"/>
               <ColorMapEntry color="#2c4b04" quantity="300" label="values"/>
               <ColorMapEntry color="#ffff00" quantity="400" label="values"/>
               <ColorMapEntry color="#dcdc00" quantity="700" label="values"/>
               <ColorMapEntry color="#b47800" quantity="1200" label="values"/>
               <ColorMapEntry color="#c85000" quantity="1400" label="values"/>
               <ColorMapEntry color="#be4100" quantity="1600" label="values"/>
               <ColorMapEntry color="#963000" quantity="2000" label="values"/>
               <ColorMapEntry color="#3c0200" quantity="3000" label="values"/>
               <ColorMapEntry color="#ffffff" quantity="5000" label="values"/>
               <ColorMapEntry color="#ffffff" quantity="13000" label="values"/>
            </ColorMap>
            <ShadedRelief/>
        </RasterSymbolizer>
      </Rule>
    </FeatureTypeStyle>
  </UserStyle>
</UserLayer>
</StyledLayerDescriptor>

Thanks,

-Sam

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Samuel Toepke ha scritto:

Hello,

I'm looking to use an SLD in GeoServer 1.5.3. to display a GeoTIFF,
with an opacity based on its seperate colors. For example, any color
darker than #7F7F7F (grey) will have an opacity of 0.0, while
anything lighter, will have a full opacity of 1.0. (Attempting to
show clouds).

I've attempted to change the standard 'raster' SLD in as many ways
possible, to no avail. I'm wondering if it is even possible for
GeoServer to support opacity based on different colors, or if I'm
just not yet familiar enough with GeoTIFFS to make it happen.

The current raster symbolizer support is very primitive. Simone
is working on a much more capable one, which he presented at
FOSS4G 2007 btw.
Simone, what's the timeline to have it in GeoServer 1.6.0?

Cheers
Andrea