2

I'm having trouble with removing white background/bounding box from raster in Geoserver. When I add WMS service in ArcMap or Autocad I'm seeing this white bounding box and to be fair I don't know how to remove it.

Here is example:

enter image description here

I even tried changing SLD styles in Geoserver but without any luck. Here is my .xml style:

<?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>te</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>
</sld:StyledLayerDescriptor>

Image is in TIFF format with 3 bands. Is it problem in style format, image itself or Geoserver? Or is it even possible to host raster images without white bounding box as seen in picture above? Any advice? :)

2

OK, I've finally figure it out. I had to install GDAL and used following command to remove white border (bounding box) GDAL command:

D:\FOLDER_NAME\RASTERS>gdalwarp -dstalpha -srcnodata 256 -dstnodata 0 input.tif output.tif

input.tif is the name of the raster (eg. county_roads.tif)and output.tif is name of the raster after command (eg.county_roads_GDAL.tif)

Here are results, hope it helps: enter image description here

Must say, installing GDAL on WIN OS is real pain in the ...

0

In the settings (in the layer page), try setting "output transparent color" to white

  • 1
    you meant InputTransparentColor under subheader Coverage Parameters? if you do, I already tried that :( – Svinjica Dec 8 '16 at 20:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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