<div dir="ltr"><div><div><div><div><div>Hello Gery,<br><br></div>Thank you for your help. I'm using version 2.12. I removed the redundant <span style="font-family:courier new,monospace">setBaseLayer(gsat)</span>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.<br>


<br></div><div>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 <a href="https://github.com/openlayers/openlayers/blob/master/lib/OpenLayers/Tile.js" target="_blank"><span style="font-family:courier new,monospace">Tile.shouldDraw()</span></a>. 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:<br>


<br><pre><div><font size="4"><span style="font-family:courier new,monospace">    <span>shouldDraw</span><span>:</span> <span>function</span><span>()</span> <span>{</span> </span></font>
</div><div><font size="4"><span style="font-family:courier new,monospace">        <span>var</span> <span>withinMaxExtent</span> <span>=</span> <span>false</span><span>,</span></span></font>
</div><div><font size="4"><span style="font-family:courier new,monospace">            <span>maxExtent</span> <span>=</span> <span>this</span><span>.</span><span>layer</span><span>.</span><span>maxExtent</span><span>;</span></span></font></div>


<div><font size="4"><span style="font-family:courier new,monospace">        <span>if</span> <span>(</span><span>maxExtent</span><span>)</span> <span>{</span></span></font>
</div><div><font size="4"><span style="font-family:courier new,monospace">            <span>var</span> <span>map</span> <span>=</span> <span>this</span><span>.</span><span>layer</span><span>.</span><span>map</span><span>;</span></span></font>
</div><div><font size="4"><span style="font-family:courier new,monospace">            <span>var</span> <span>worldBounds</span> <span>=</span> <span>map</span><span>.</span><span>baseLayer</span><span>.</span><span>wrapDateLine</span> <span>&&</span> <span>map</span><span>.</span><span>getMaxExtent</span><span>();</span></span></font>
</div><div><font size="4"><span style="font-family:courier new,monospace">            <span>if</span> <span>(</span><span>this</span><span>.</span><span>bounds</span><span>.</span><span>intersectsBounds</span><span>(</span><span>maxExtent</span><span>,</span> <span>{</span><span>inclusive</span><span>:</span> <span>false</span><span>,</span> <span>worldBounds</span><span>:</span> <span>worldBounds</span><span>}))</span> <span>{</span></span></font>
</div><div><font size="4"><span style="font-family:courier new,monospace">                <span>withinMaxExtent</span> <span>=</span> <span>true</span><span>;</span></span></font>
</div><div><font size="4"><span style="font-family:courier new,monospace">            <span>}</span></span></font></div><div><font size="4"><span style="font-family:courier new,monospace">        <span>}</span></span></font><br>

<br></div><div><font size="4"><span style="font-family:courier new,monospace">        <span>return</span> <span>withinMaxExtent</span> <span>||</span> <span>this</span><span>.</span><span>layer</span><span>.</span><span>displayOutsideMaxExtent</span><span>;</span></span></font>
</div><div><font size="4"><span style="font-family:courier new,monospace">    <span>},</span></span></font><font size="4">  </font></div></pre></div><div><br></div><div>I captured the value of the worldBounds, this.bounds and maxExtent variables inside it to create a test that anyone can reproduce:<br>


<span style="font-family:courier new,monospace"><br><br>// Test #1: values captured in a zoom request for which the WMS overlay was NOT rendered<br>function test1() {<br>    var bounds = new OpenLayers.Bounds(-3785006.7128486, 2429373.3721214, 3729058.9146514, 8064922.5927464);<br>


    var maxExtent = new OpenLayers.Bounds(-180, -90, 180, 90);<br>    var worldBounds = new OpenLayers.Bounds(-20037508.34, -20037508.34, 20037508.34, 20037508.34);<br>    <br>    if (bounds.intersectsBounds(maxExtent, {inclusive: false, worldBounds: worldBounds})) {<br>


        return "Intersected";<br>    } <br> <br>    return "Not intersected";<br>}<br><br>//Example #2: values captured in a zoom request for which the WMS overlay did render<br>function test2() {<br>

    var bounds = new OpenLayers.Bounds(-7776854.077458, -677027.4569557, 7251277.177542, 10594070.984294);<br>
    var maxExtent = new OpenLayers.Bounds(-180, -90, 180, 90);<br>    var worldBounds = new OpenLayers.Bounds(-20037508.34, -20037508.34, 20037508.34, 20037508.34);<br>    <br>    if (bounds.intersectsBounds(maxExtent, {inclusive: false, worldBounds: worldBounds})) {<br>


        return "Intersected";<br>    } <br> <br>    return "Not intersected";<br>}<br></span><br><br></div>Does anyone in the community knows why the first test does not intersect?<br><br></div>- Is the Bounds.intersectsBounds() implementation incorrect?<br>


</div>- Are any of these values inside the function invalid or absurd? If so, why?<br></div><br><div><div><div><div><div><div class="gmail_extra">

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...<br><br><br></div><div class="gmail_extra">Best regards,<br></div>

<div class="gmail_extra"><br></div><div class="gmail_extra">Dalton<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Apr 20, 2013 at 1:32 PM, Gery . <span dir="ltr"><<a href="mailto:gamejihou@hotmail.com" target="_blank">gamejihou@hotmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">



Hi Dalton,<br>
<br>
Are you using OL 2.12 or 2.11? I don't think you need<br>
setBaseLayer(gsat);<br>
because you already set that. I use google3 and 2.11 and it works perfect without that.<br>
<br>
HTH,<br>
<br>
Cheers,<br>
<br>
Gery<br>
<br>
<br>
Sent from my iBath<br>
<div><div><br>
On Apr 20, 2013, at 17:56, "Dalton Filho" <<a href="mailto:daltonfilho@gmail.com" target="_blank">daltonfilho@gmail.com</a>> wrote:<br>
<br>
Hello list,<br>
<br>
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.<br>
<br>
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.<br>
<br>
I have attached 4 files that reproduce the error (you should edit the openlayers inclusion or paste them under the examples directory)<br>
<br>
Has anyone had the same issue?<br>
<br>
Best regards,<br>
<br>
Dalton<br>
</div></div><google-v2-test.html><br>
<google-v2-test.js><br>
<google-v3-test.html><br>
<google-v3-test.js><br>
_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.osgeo.org" target="_blank">Users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/openlayers-users" target="_blank">http://lists.osgeo.org/mailman/listinfo/openlayers-users</a><br>
</blockquote></div><br></div></div></div></div></div></div></div>