We are showing US States using GWC.
When the user selects a state, we show a "selected polygon" layer on top of it:
As you can see from the image, the yellow Highlighted WMS layer is incorrectly rendering on top of the red GWC layer of states.
Both are the same layer in Geoserver. The layer has two styles available: the thin red line and the thicker yellow line.
We are rendering it once with plain GWC, and once as a WMS layer (with a filter on it to only show the selected state).
Both the GWC and WMS layers are in Google Maps, which is requesting 256 x 256 tiles.
BTW this only happens at lower zoom levels. As you zoom in, the two line up better until they completely overlap at about zoom level 7.
Again, this is the exact same layer, the only difference is the service endpoint: GWC in one, and WMS in the other.
Edit: Ian asked me to post this additional information:
Here is the GetCapabilities info for this layer:
<Layer queryable="1" opaque="0">
<Name>MyWorkspace:state</Name>
<Title>state</Title>
<Abstract/>
<KeywordList>
<Keyword>features</Keyword>
<Keyword>state</Keyword>
</KeywordList>
<SRS>EPSG:4326</SRS>
<LatLonBoundingBox minx="-180.0" miny="-90.0" maxx="180.0" maxy="90.0"/>
<BoundingBox SRS="EPSG:4326" minx="-180.0" miny="-90.0" maxx="180.0" maxy="90.0"/>
<Style>
<Name>MyWorkspace:state</Name>
<Title>Default Polygon</Title>
<Abstract>A sample style that draws a polygon</Abstract>
<LegendURL width="20" height="20">
<Format>image/png</Format>
<OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="http://tiles.MyWorkspace.com:80/geoserver/wms?request=GetLegendGraphic&format=image%2Fpng&width=20&height=20&layer=MyWorkspace%3Astate"/>
</LegendURL>
</Style>
<Style>
<Name>MyWorkspace:state</Name>
<Title>Default Polygon</Title>
<Abstract>A sample style that draws a polygon</Abstract>
<LegendURL width="20" height="20">
<Format>image/png</Format>
<OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="http://tiles.MyWorkspace.com:80/geoserver/wms?request=GetLegendGraphic&format=image%2Fpng&width=20&height=20&layer=MyWorkspace%3Astate&style=state"/>
</LegendURL>
</Style>
</Layer>
I can't actually post my code, but here are sample URLs:
GWC URL: /geoserver/gwc/service/gmaps?layers=MyWorkspace:state&zoom=6&x=17&y=25&format=image/png&styles=MyWorkspace:state
WMS (GetMap) URL: /geoserver/wms?request=GetMap&service=WMS&version=1.1.1&layers=state&srs=EPSG:4326&format=image%2Fpng&bbox=-101.25,40.97989806962013,-90,48.922499263758255&width=256&height=256&tiled=true&format=image/png&transparent=true&styles=PolygonHighlight&cql_filter=id%20=%2044
Another Edit:
It looks like this may be a screen coordinates to map coordinates conversion issue. We use Google Maps' ImageMapType class (https://developers.google.com/maps/documentation/javascript/reference/image-overlay#ImageMapType) to render both our GWC and WMS layers. But GWC doesn't require conversion of screen coordinates to map coordinates. It takes screen coordinates (tile numbers) as inputs. The WMS endpoint, however, requires a bounding box. Since the version of the Google Maps API that we are using didn't offer a fromPointToLatLng method, we relied on some conversion code I found on the internet (http://blog.canberraphotography.com.au/googlewms/ was the url, but it's dead now). It looks like upgrading to the latest google maps API may be the answer.