Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 2.1-RC1
-
Fix Version/s: 2.2-beta2
-
Component/s: None
-
Labels:None
-
Number of attachments :4
Description
Direct raster path does not support raster symbolizer opacity (to generate a translucent PNG out of a single raster image).
The GridCoverageRenderer in fact lets java2d handle that part. We might want to disable the direct path if the opacity
in the raster symbolizer is less than 0
-
Hide
- Raster_GEOS-4336.zip
- 27/Dec/11 4:42 AM
- 1.26 MB
- Jonas Reinhardt
-
- Raster_Colormap.sld 1 kB
- Layer_Settings.pdf 51 kB
- Raster.prj 0.4 kB
- Raster.tfw 0.1 kB
- Raster.tif 2.63 MB
-
- nurc-Pk50095.png
- 24 kB
- 02/Nov/11 2:18 PM
-
- sf-sfdem.png
- 96 kB
- 02/Nov/11 4:08 PM
-
- topp-txraster.png
- 14 kB
- 29/Dec/11 5:15 AM
Issue Links
Activity
Bulk closing all resolved issue that have not gotten any more feedback or comment in the last month
This issue is still present in Geoserver 2.1.2. A style with semi-transparent raster symbolizer opacity (for example : 0.5) is not rendered properly.
Downloaded GS 2.1.2, created a r50 style that is the same as raster but uses 0.5 as opacity, set output to png:
The result is 50% transparent, as expected. Attached.
Also tried with a colormap based style, changing the opacity in the "dem" style to 0.5, here is the result. It's traslucent as expected, as far as I can see
This is a style that does not works properly (with Geoserver 2.0.2 I obtained a gradient with semi-transparent opacity whereas with Geoserver 2.1.2 I obtained an non transparent png except for the 0 value) :
<?xml version="1.0" encoding="UTF-8"?>
<sld:UserStyle xmlns="http://www.opengis.net/sld" xmlns:sld="http://www.opengis.net/sld" xmlns:ogc="http://www.opengis.net/ogc" xmlns:gml="http://www.opengis.net/gml">
<sld:Name>msg_hrv_transparent</sld:Name>
<sld:Title>Transparent</sld:Title>
<sld:Abstract>Transparent</sld:Abstract>
<sld:FeatureTypeStyle>
<sld:Name>name</sld:Name>
<sld:Rule>
<sld:RasterSymbolizer>
<sld:Geometry>
<ogc:PropertyName>geom</ogc:PropertyName>
</sld:Geometry>
<sld:ChannelSelection>
<sld:GrayChannel>
<sld:SourceChannelName>1</sld:SourceChannelName>
</sld:GrayChannel>
</sld:ChannelSelection>
<sld:ColorMap>
<sld:ColorMapEntry color="#999999" opacity="0" quantity="0"/>
<sld:ColorMapEntry color="#FFFFFF" opacity="0.8" quantity="128"/>
<sld:ColorMapEntry color="#FFFFFF" opacity="1.0" quantity="256"/>
</sld:ColorMap>
</sld:RasterSymbolizer>
</sld:Rule>
</sld:FeatureTypeStyle>
</sld:UserStyle>
Ah, opacity in the color map, not in the main symbolizer element. Now we're getting somewhere. Simone, does it ring any bell to you?
I managed to reproduce the problem by using the usa raster with the style Nicolas provided, the translucency is created properly
by the direct raster path and is then lost during PNG encoding when calling forceIndexColorModelForGIF(true) inside ImageWorker.writePNG(...)
I guess we should not really do that, is there any palette type that PNG cannot encode properly?
Simone, the following seems to fix the issue, but I don't know if there are bad ramifications or side effects:
--- a/modules/library/coverage/src/main/java/org/geotools/image/ImageWorker.java +++ b/modules/library/coverage/src/main/java/org/geotools/image/ImageWorker.java @@ -2413,8 +2413,10 @@ public class ImageWorker { // Reformatting this image for PNG. if (!paletted) { forceComponentColorModel(); - }else{ - forceIndexColorModelForGIF(true); + } else { + if(!(getRenderedImage().getColorModel() instanceof IndexColorModel)) { + forceIndexColorModelForGIF(true); + } } if(LOGGER.isLoggable(Level.FINER)) LOGGER.finer("Encoded input image for png writer");
What do you think?
Just want to confirm that the problem still exists in GeoServer ver 2.1.2 (gt v2.7.1?)
We previous ran 2.1.0 with the following ColorMap.
With ver 2.1.2 the opacity value is just 0 or opaque for everything from >0..1
<ColorMap type="intervals"> <ColorMapEntry color="#008000" quantity="5.99" label="0-6.0m/s" opacity="0"/> <ColorMapEntry color="#38a800" quantity="6.49" label="6.0-6.5m/s" opacity="0.4"/> <ColorMapEntry color="#ffff00" quantity="6.99" label="6.5-7.0m/s" opacity="0.4"/> <ColorMapEntry color="#ff8000" quantity="7.49" label="7.0-7.5m/s" opacity="0.4"/> <ColorMapEntry color="#ff0000" quantity="12" label="7.5-12m/s" opacity="0.4"/> </ColorMap>
The problem still exists in GeoServer ver 2.1.3.
To illustrate I did put the same layer through 2.1.0 and 2.1.3 with the same SLD.
Check the layerswitcher at:
http://gaia.projektnav.net/TestGeoserver_v210-213.htm
(Because it is difficult to downgrade we have to run both versions...
)
I downloaded just right now 2.1.3 and used a colormap with per colormpaentry alpha channel. What I get out is a RGBA image (not paletted) with alpha definitely used.
With the data I have available, it works. Please share yours somehow, with the data I have it works as expected.
Greetings, thanks for looking into the colormap issue.
I attached a zip containing the raster, sld and a few layer settings to reproduce the effect.
I have looked through the settings in our 2.1.0 and 2.1.3 instance many times and they are the same to what I can understand.
If you only apply a <Opacity>0.5</Opacity> setting in the <RasterSymbolizer> it will show with that opacity, but if you add the colormap the opacity is gone.
If the raster is invalid in 2.1.3 please advise what we can use.
This is the exact raster shown by the link above.
Files for the Reinhardt comment - 27/Dec/11 4:41 AM, appears as attachment on top of this issue
Been working on a fix, here is an output from your sample file and style.
The transparency in kept, and also the paletted nature of the output, so it both looks good and retains a small size
Should be fixed now. Nightly build will include the fix starting tomorrow Dec 30:
http://gridlock.opengeo.org/geoserver/2.1.x/
I can confirm that the issue is fixed on 2.1.x Nightly build. Thank you
Switching all issues that have been in "resolved" state for more than one month without further comments to "closed" status
Fixed in GeoTools