Raster SLD transparency not consistently working

Description

I seem to be encountering an issue related to raster stores (geoTiff or ImageMosaic JDB) and SLD visualization. Here is my explanation. The geotiff is 33mb so I can not upload this, however if you would like the original file please contact me. I have place screen shots that hopefully clear up the issue.

The goal is to make an application that allows the user to visualize a raster dataset by turning pixel values on and off. Currently we are working with the raster dataset GLC2000, which is the landcover classification of the world for the year 2000. We have created an SLD for this dataset that converts the raster to transparent, setting each pixel value opacity to zero. Through the application users can turn on and off raster pixel values like water. We simply update the SLD with the env parameter 'env=lcwater:1'. Now all of the water is visible on the map.

Here is a subset of the SLD we are currently using
Title>Global Landcover Legend dynamic</Title>
<Abstract>.....Text goes here.....</Abstract>

<FeatureTypeStyle>
<Rule>
<RasterSymbolizer>
<ColorMap type="values">
<ColorMapEntry color="#FFFFFF" quantity="0" opacity ="${env('lcprimveg',0)}" />
<ColorMapEntry color="#00CC00" quantity="1" opacity ="${env('lcbrdevgrn',0)}"/>
<ColorMapEntry color="#00CC00" quantity="2" opacity ="${env('lcdecidcl',0)}" />
<ColorMapEntry color="#80E680" quantity="3" opacity ="${env('lcdecidop',0)}" />
<ColorMapEntry color="#00CC00" quantity="4" opacity ="${env('lcndlevgrn',0)}"/>
<ColorMapEntry color="#00CC00" quantity="5" opacity ="${env('lcndldecid',0)}" />
<ColorMapEntry color="#00CC00" quantity="6" opacity ="${env('lcmxlftree',0)}" />
<ColorMapEntry color="#00FF99" quantity="7" opacity ="${env('lcaqtrfrsh',0)}" />
<ColorMapEntry color="#99CCFF" quantity="20" opacity ="${env('lcwater',0)}" />

The problem we are having is that the raster style (SLD) is not working at all map extents. The raster layer has the native SRS set as 4326 and the declared SRS set to 3857. SRS handling is set to project native to declared. The interpolation is set to nearest neighbor and the default SLD is glc_dynamic.

I preview the glc_dynamic raster layer through geoserver everything shows up fine, the screen is blank.I add the &env=lcwater:1 parameter and now I see water across the whole map. The only thing visible on the map is water. Preview scale is at 1:279M, rough bbox dimensions are -19144282.29W and 13927505.70963E. Now if I Pan west to -19535201.77042 the entire color legend is now visible on the map. This same error will occur if I pan to far east. If map zoom level goes out further to 1:558M. The error disappears, by some potential artifacts appear around the east and west edges of the map.

I pulled the map requests from the log file to determine what was going on. I don't find any errors. Comparing the two files, I get differences on two lines. However these just look like differences in the bbox request. I am unable to recreate this error using the same raster data set in its native WGS84 projection or if I project it to 3857 and add it as a new data storage. However, this error does appear when I use the geoserver raster projection framework.

Request #1 (Initial View, No error)
AUTHORITY["EPSG","3857"]]
Bbox = SRSEnvelope[-1.926155811957313E7 : 1.3966597672528865E7, -1.6109824066402005E7 : 4.401359194330725E7]
RemoteOwsType = null
RemoteOwsURL = null
Env = {GSUSER=auser, LCWATER=1}
FormatOptions = {}
Angle = 0.0
CQLFilter = null
Elevation = []
FeatureId = null
StartIndex = null
ViewParams = null
Transparent = true
StyleFormat = sld
SldBody = null
ValidateSchema = false
Sld = null
StyleUrl = null
TilesOrigin = null
Interpolations = []
Filters = null
Exceptions = SE_XML
StyleBody = null
SldVersion = null
StyleVersion = null
ScaleMethod = null
Version = 1.1.1
Request = GetMap
Get = true
RawKvp = {TRANSPARENT=true, BBOX=-19261558.11957313,-16109824.066402005,13966597.672528865,44013591.94330725, VERSION=1.1.1, FORMAT=image/jpeg, SERVICE=WMS, HEIGHT=769, ENV=lcwater:1, REQUEST=GetMap, LAYERS=Shoumith:glc_dynamic, STYLES=Shoumith:glc_dynamic, SRS=EPSG:3857, WIDTH=425}
BaseUrl = https://localhost:8080/geoserver/
RequestCharset = UTF-8

Request #2 (Pan West, with error)
AUTHORITY["EPSG","3857"]]
Bbox = SRSEnvelope[-1.965247759948021E7 : 1.3575678192621782E7, -1.6109824066402005E7 : 4.401359194330725E7]
RemoteOwsType = null
RemoteOwsURL = null
Env = {GSUSER=auser, LCWATER=1}
FormatOptions = {}
Angle = 0.0
CQLFilter = null
Elevation = []
FeatureId = null
StartIndex = null
ViewParams = null
Transparent = true
StyleFormat = sld
SldBody = null
ValidateSchema = false
Sld = null
StyleUrl = null
TilesOrigin = null
Interpolations = []
Filters = null
Exceptions = SE_XML
StyleBody = null
SldVersion = null
StyleVersion = null
ScaleMethod = null
Version = 1.1.1
Request = GetMap
Get = true
RawKvp = {TRANSPARENT=true, BBOX=-19652477.59948021,-16109824.066402005,13575678.192621782,44013591.94330725, VERSION=1.1.1, FORMAT=image/jpeg, SERVICE=WMS, HEIGHT=769, ENV=lcwater:1, REQUEST=GetMap, LAYERS=Shoumith:glc_dynamic, STYLES=Shoumith:glc_dynamic, SRS=EPSG:3857, WIDTH=425}
BaseUrl = https://localhost:8080/geoserver/
RequestCharset = UTF-8

Environment

Geoserver 2.7.1
Linux with Apache Tomcat

Assignee

Unassigned

Reporter

David Haynes

Triage

None

Fix versions

None

Affects versions

Components

Priority

Medium
Configure