Hello Gery, Thank you for your help. I'm using version 2.12. I removed the redundant setBaseLayer(gsat)line but the WMS overlay still fails to appear unless I zoom out twice. I did the same test using version 2.11 but results are identical. After I zoom in to a certain zoom level the overlay simply disappears whereas in the Google Maps v.2 test they did show at that same zoom level.
I compared the stack trace of zoom-in requests that rendered the overlay with the stack trace of requests that did not render it. The point where it fails is the method Tile.shouldDraw()<https://github.com/openlayers/openlayers/blob/master/lib/OpenLayers/Tile.js>. It is returning false for the zoom-in requests for which the overlay was not rendered. This method returns true when the overlays are rendered. This is the method in question: shouldDraw: function() { var withinMaxExtent = false, maxExtent = this.layer.maxExtent; if (maxExtent) { var map = this.layer.map; var worldBounds = map.baseLayer.wrapDateLine && map.getMaxExtent(); if (this.bounds.intersectsBounds(maxExtent, {inclusive: false, worldBounds: worldBounds})) { withinMaxExtent = true; } } return withinMaxExtent || this.layer.displayOutsideMaxExtent; }, I captured the value of the worldBounds, this.bounds and maxExtent variables inside it to create a test that anyone can reproduce: // Test #1: values captured in a zoom request for which the WMS overlay was NOT rendered function test1() { var bounds = new OpenLayers.Bounds(-3785006.7128486, 2429373.3721214, 3729058.9146514, 8064922.5927464); var maxExtent = new OpenLayers.Bounds(-180, -90, 180, 90); var worldBounds = new OpenLayers.Bounds(-20037508.34, -20037508.34, 20037508.34, 20037508.34); if (bounds.intersectsBounds(maxExtent, {inclusive: false, worldBounds: worldBounds})) { return "Intersected"; } return "Not intersected"; } //Example #2: values captured in a zoom request for which the WMS overlay did render function test2() { var bounds = new OpenLayers.Bounds(-7776854.077458, -677027.4569557, 7251277.177542, 10594070.984294); var maxExtent = new OpenLayers.Bounds(-180, -90, 180, 90); var worldBounds = new OpenLayers.Bounds(-20037508.34, -20037508.34, 20037508.34, 20037508.34); if (bounds.intersectsBounds(maxExtent, {inclusive: false, worldBounds: worldBounds})) { return "Intersected"; } return "Not intersected"; } Does anyone in the community knows why the first test does not intersect? - Is the Bounds.intersectsBounds() implementation incorrect? - Are any of these values inside the function invalid or absurd? If so, why? In the meanwhile the only thing I can do is to skip the shouldDraw() verification and force draw = true inside Tile.draw(). A dirty hack to keep me afloat... Best regards, Dalton On Sat, Apr 20, 2013 at 1:32 PM, Gery . <gameji...@hotmail.com> wrote: > Hi Dalton, > > Are you using OL 2.12 or 2.11? I don't think you need > setBaseLayer(gsat); > because you already set that. I use google3 and 2.11 and it works perfect > without that. > > HTH, > > Cheers, > > Gery > > > Sent from my iBath > > On Apr 20, 2013, at 17:56, "Dalton Filho" <daltonfi...@gmail.com> wrote: > > Hello list, > > I created a map with Google layers as base layers + a WMS overlay layer. > Unfortunately the WMS overlay disappears when zooming in. In fact, you can > only start seeing the WMS overlay after you zoom out twice. > > In another test I created a map with Google Maps v.2 base layers + the > *same* WMS overlay layer I used in the first test. This time the WMS > overlay shows in all zoom levels. > > I have attached 4 files that reproduce the error (you should edit the > openlayers inclusion or paste them under the examples directory) > > Has anyone had the same issue? > > Best regards, > > Dalton > <google-v2-test.html> > <google-v2-test.js> > <google-v3-test.html> > <google-v3-test.js> > _______________________________________________ > Users mailing list > us...@lists.osgeo.org > http://lists.osgeo.org/mailman/listinfo/openlayers-users >
_______________________________________________ Users mailing list us...@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/openlayers-users