1

I had published an ECW file in geoserver 2.11.2 with SLD generated from QGIS. After publishing the layer i could see some black region in layers preview with the SLD generated from QGIS as below. This is the SLD generated from QGIS

<?xml version="1.0" ?>
<sld:StyledLayerDescriptor version="1.0.0" xmlns="http://www.opengis.net/sld" xmlns:gml="http://www.opengis.net/gml" xmlns:ogc="http://www.opengis.net/ogc" xmlns:sld="http://www.opengis.net/sld">
<sld:UserLayer>
    <sld:LayerFeatureConstraints>
        <sld:FeatureTypeConstraint/>
    </sld:LayerFeatureConstraints>
    <sld:UserStyle>
        <sld:Name>SAD61_Tamale_Satellite_ECW25_20170114</sld:Name>
        <sld:Title/>
        <sld:FeatureTypeStyle>
            <sld:Name/>
            <sld:Rule>
                <sld:RasterSymbolizer>
                    <sld:Geometry>
                        <ogc:PropertyName>grid</ogc:PropertyName>
                    </sld:Geometry>
                    <sld:Opacity>1</sld:Opacity>
                    <sld:ChannelSelection>
                        <sld:RedChannel>
                            <sld:SourceChannelName>1</sld:SourceChannelName>
                        </sld:RedChannel>
                        <sld:GreenChannel>
                            <sld:SourceChannelName>2</sld:SourceChannelName>
                        </sld:GreenChannel>
                        <sld:BlueChannel>
                            <sld:SourceChannelName>3</sld:SourceChannelName>
                        </sld:BlueChannel>
                    </sld:ChannelSelection>
                </sld:RasterSymbolizer>
            </sld:Rule>
        </sld:FeatureTypeStyle>
    </sld:UserStyle>
</sld:UserLayer>

enter image description here

If i publish the layer with default raster style, i could see some black speckles around the boundary as below

enter image description here

How to remove those black region after it gets published in geoserver?

2
  • And your question is?
    – Ian Turton
    Commented Aug 14, 2017 at 19:16
  • Edited the post
    – User123
    Commented Aug 16, 2017 at 3:54

1 Answer 1

0

Either you have an alpha channel included in the file or the default raster style seems to assume that black (#000000) should be the NODATA value and GeoServer makes it transparent. That is basically what you want to achieve. But due to the lossy ECW compression, areas along the edges between black and not black show compression artifacts and thus are not completely black. Same artifacts appear when using an alpha channel.


Possible Solutions:

1) Use a lossless compression method:

With a lossless compression, you will not have artifacts at the edges and the NODATA value will work well. Make sure you use jai-ext extension, as normal jai has problems with NODATA.

If you receive the data already lossy, that is not easily possible anymore. You could convert your data with gdal's nearblack command, but that might produce other problems.

2) Make us of masks / footprints:

  • Create an exact bitmask (raster) of your NODATA value and convert to a format that allows bit masks (e.g. GeoTiff)

    • gdal_translate -b 1 -b 2 -b 3 -mask 4 [...]
  • Use GeoServer ImageMosaic with footprint management. This is the only solution I can think of when you need to stick to your ECW files.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.