0

I have a geotiff file which contains three bands and the value is 'no-data' at the edge of the image:

enter image description here

However after published in geoserver, I got this:

enter image description here

Note the white background in the image, while I want it is transparent.

Is this possible?


update:

I use the following command gdal_translate -a_nodata 0 -of GTiff D:/01.tif D:/02.tif in qgis to translate the geotiff file.

When publish in geoserver I set the InputTransparentColor to 0:

enter image description here

And the default raster style in geoserver:

<?xml version="1.0" encoding="UTF-8"?>
<StyledLayerDescriptor>
  <NamedLayer>
    <Name>default_raster</Name>
    <UserStyle>
      <Title>Default Raster</Title>
      <Abstract></Abstract>
      <FeatureTypeStyle>
        <Rule>
          <Name>rule1</Name>
          <Title>Opaque Raster</Title>
          <Abstract>A raster with 100% opacity</Abstract>
          <RasterSymbolizer>
            <Opacity>1.0</Opacity>
            <ChannelSelection> 
              <RedChannel> 
                <SourceChannelName>1</SourceChannelName> 
              </RedChannel> 
              <GreenChannel> 
                <SourceChannelName>2</SourceChannelName> 
              </GreenChannel> 
              <BlueChannel> 
                <SourceChannelName>3</SourceChannelName> 
              </BlueChannel> 
            </ChannelSelection>
          </RasterSymbolizer>
        </Rule>
      </FeatureTypeStyle>
    </UserStyle>
  </NamedLayer>
</StyledLayerDescriptor>
giser
  • 953
  • 1
  • 11
  • 31
  • http://gis.stackexchange.com/questions/10674/transparent-raster-in-geoserver might help. – BradHards Feb 12 '17 at 03:51
  • I have tried that, and use gdal_translate to convert the tiff, does not work. – giser Feb 12 '17 at 03:52
  • 1
    I don't think you read the answers in the link I provided. You don't have an colormap with opacity 0 for your nodata value. I also don't think you specified the nodata value (0) when you wrote FFFFFF. – BradHards Feb 12 '17 at 04:37
  • I follow this link 'http://gis.stackexchange.com/questions/10674/transparent-raster-in-geoserver#comment86908_10676' – giser Feb 12 '17 at 04:39
  • Maybe you mean the FFFFFF it is auto changed by geoserver once I enter 0 for the field. – giser Feb 12 '17 at 07:14
  • Or to really put a transparency value into your SLD, as shown in the linked example. – BradHards Feb 12 '17 at 08:11

0 Answers0