<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 12 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
@font-face
        {font-family:"Times New Roman \, serif";}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";
        color:black;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML amb format previ Car";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";
        color:black;}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
        {mso-style-priority:99;
        mso-style-link:"Text de globus Car";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:8.0pt;
        font-family:"Tahoma","sans-serif";
        color:black;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
        {mso-style-priority:34;
        margin-top:0cm;
        margin-right:0cm;
        margin-bottom:0cm;
        margin-left:36.0pt;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";
        color:black;}
span.HTMLambformatpreviCar
        {mso-style-name:"HTML amb format previ Car";
        mso-style-priority:99;
        mso-style-link:"HTML amb format previ";
        font-family:Consolas;
        color:black;}
span.TextdeglobusCar
        {mso-style-name:"Text de globus Car";
        mso-style-priority:99;
        mso-style-link:"Text de globus";
        font-family:"Tahoma","sans-serif";
        color:black;}
span.EstilCorreuElectrnic22
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.EstilCorreuElectrnic23
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.EstilCorreuElectrnic24
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.EstilCorreuElectrnic25
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:70.85pt 3.0cm 70.85pt 3.0cm;}
div.WordSection1
        {page:WordSection1;}
/* List Definitions */
@list l0
        {mso-list-id:1162551237;
        mso-list-type:hybrid;
        mso-list-template-ids:1141640496 67305493 67305497 67305499 67305487 67305497 67305499 67305487 67305497 67305499;}
@list l0:level1
        {mso-level-number-format:alpha-upper;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l0:level2
        {mso-level-tab-stop:72.0pt;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l0:level3
        {mso-level-tab-stop:108.0pt;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l0:level4
        {mso-level-tab-stop:144.0pt;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l0:level5
        {mso-level-tab-stop:180.0pt;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l0:level6
        {mso-level-tab-stop:216.0pt;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l0:level7
        {mso-level-tab-stop:252.0pt;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l0:level8
        {mso-level-tab-stop:288.0pt;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l0:level9
        {mso-level-tab-stop:324.0pt;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
ol
        {margin-bottom:0cm;}
ul
        {margin-bottom:0cm;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body bgcolor=white lang=CA link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='color:#1F497D'>Hi Alexandre,<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>I fixed the issue as follows; creating a new layer with main parameters copied from original. It’s quite similar of your code, because you clone the layer.<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>Old code:<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>layerPreview = layer.clone();<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>mapPanelPreview.map.addLayer(layerPreview);<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>My code:<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>var newLayer = new OpenLayers.Layer.WMS(layerPreview.name, this.wmsbrowser.currentUrl,{layers: layerPreview.params.LAYERS, format:"image/png", transparent: "true", exceptions:"application/vnd.ogc.se_xml"});<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>mapPanelPreview.map.addLayer(newLayer);<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>Thanks for your attetion,<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:#0D0D0D'>Antoni Vidal</span></b><span style='color:#0D0D0D'><o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:gray'>Unitat d'Aplicacions SIG-WEB<br><a href="http://mercuri.icc.cat/website/mob_nf/mob1/mob2/inici2.htm?CONSULTA=Institut%20Cartogr%25E0fic%20de%20Catalunya&XYADDRESS=429486:4580392"><span style='color:gray'>Institut Cartogràfic de Catalunya</span></a><br>Parc de Montjuïc, E-08038 Barcelona<br>Tel. (+34) 93 567 15 00 (ext. 3228)<br><a href="http://www.icc.cat/">www.icc.cat</a></span><span style='color:#1F497D'><o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></span></p><div><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext'>De:</span></b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext'> Alexandre Dubé [mailto:adube@mapgears.com] <br><b>Enviat:</b> martes, 25 de septiembre de 2012 17:46<br><b>Per a:</b> Vidal, Antoni<br><b>A/c:</b> GeoEXT Users<br><b>Tema:</b> Re: [Users] Error in WMSBrowserTreePanel.js<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p> </o:p></p><div><p class=MsoNormal>Antoni,<br><br> Please, include the list in CC.<br><br> At this point, I'm not sure what could be done to solve the issue.<br><br>Alexandre<br><br><br>On 12-09-25 10:15 AM, Vidal, Antoni wrote:<o:p></o:p></p></div><blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'><p class=MsoNormal><span style='color:#1F497D'>Hi Alexander,</span><o:p></o:p></p><p class=MsoNormal><span style='color:#1F497D'> </span><o:p></o:p></p><p class=MsoNormal><span style='color:#1F497D'>I’ve made your change but doesn’t work. After that I’ve changed code in WMSBrowserTreePanel.js just before addLayer to map, wich launch the error.</span><o:p></o:p></p><p class=MsoNormal><span style='color:#1F497D'> </span><o:p></o:p></p><p class=MsoNormal><span style='color:#1F497D'>Look at:</span><o:p></o:p></p><p class=MsoNormal><span style='color:#1F497D'> </span><o:p></o:p></p><p class=MsoNormal><span style='color:#1F497D'> layerPreview.mergeNewParams(</span><o:p></o:p></p><p class=MsoNormal><span style='color:#1F497D'> {'LAYERS': [layerPreview.params.LAYERS]}</span><o:p></o:p></p><p class=MsoNormal><span style='color:#1F497D'> );</span><o:p></o:p></p><p class=MsoNormal><span style='color:#1F497D'> </span><o:p></o:p></p><p class=MsoNormal><span style='color:#1F497D'> console.info(layerPreview);</span><o:p></o:p></p><p class=MsoNormal><span style='color:#1F497D'> layerPreview.minScale = null;</span><o:p></o:p></p><p class=MsoNormal style='margin-left:70.8pt;text-indent:35.4pt'><span style='color:#1F497D'>layerPreview.maxScale = null;</span><o:p></o:p></p><p class=MsoNormal><span style='color:#1F497D'> layerPreview.resolutions = [275,100,50,25,10,5,2,1,0.5,0.25];</span><o:p></o:p></p><p class=MsoNormal><span style='color:#1F497D'> layerPreview.numZoomLevels = 10;</span><o:p></o:p></p><p class=MsoNormal><span style='color:#1F497D'> layerPreview.maxResolution = 275;</span><o:p></o:p></p><p class=MsoNormal><span style='color:#1F497D'> console.info(layerPreview);</span><o:p></o:p></p><p class=MsoNormal><span style='color:#1F497D'> </span><o:p></o:p></p><p class=MsoNormal><span style='color:#1F497D'> mapPanelPreview.map.addLayer(layerPreview);</span><o:p></o:p></p><p class=MsoNormal><span style='color:#1F497D'> </span><o:p></o:p></p><p class=MsoNormal><span style='color:#1F497D'>The first cosole.info shows “Infinity” in minScale and null next properties. The second, shows the new values but error persist.</span><o:p></o:p></p><p class=MsoNormal><span style='color:#1F497D'> </span><o:p></o:p></p><p class=MsoNormal><span style='color:#1F497D'>I don’t understand at all...</span><o:p></o:p></p><p class=MsoNormal><span style='color:#1F497D'> </span><o:p></o:p></p><p class=MsoNormal><span style='color:#1F497D'>Any other suggestion ?</span><o:p></o:p></p><p class=MsoNormal><span style='color:#1F497D'> </span><o:p></o:p></p><p class=MsoNormal><span style='color:#1F497D'>Thanks a lot,</span><o:p></o:p></p><p class=MsoNormal><span style='color:#1F497D'> </span><o:p></o:p></p><p class=MsoNormal><span style='color:#1F497D'>Antoni.</span><o:p></o:p></p><p class=MsoNormal><span style='color:#1F497D'> </span><o:p></o:p></p><div><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext'>De:</span></b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext'> Alexandre Dubé [<a href="mailto:adube@mapgears.com">mailto:adube@mapgears.com</a>] <br><b>Enviat:</b> martes, 25 de septiembre de 2012 14:50<br><b>Per a:</b> Vidal, Antoni; GeoEXT Users<br><b>Tema:</b> Re: [Users] Error in WMSBrowserTreePanel.js</span><o:p></o:p></p></div></div><p class=MsoNormal> <o:p></o:p></p><div><p class=MsoNormal>Hi Antoni,<br><br> I added the list in CC.<br><br> The tree uses the WMSCapabilitiesLoader to trigger the WMS GetCapabilities requests. Looking at the code in GeoExt 1.1, is parameters are returned by the getParams methos, which looks like this :<br><br> getParams: function(node) {<br> return {'service': 'WMS', 'request': 'GetCapabilities'};<br> },<br><br> You could try to override this method :<br><br>GeoExt.tree.WMSCapabilitiesLoader.prototype.getParams = function(node) {<br> return {'service': 'WMS', 'request': 'GetCapabilities', 'version': '1.1.1'};<br>}; <br><br>HTH,<br><br>Alexandre<br><br><br>On 12-09-25 08:36 AM, Vidal, Antoni wrote:<o:p></o:p></p></div><blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'><p class=MsoNormal><span style='color:#1F497D'>Hi Alexander,</span><o:p></o:p></p><p class=MsoNormal><span style='color:#1F497D'> </span><o:p></o:p></p><p class=MsoNormal><span style='color:#1F497D'>I’ve made the test, and GML as plain text in a file parsed by OpenLayers.Format.WMSCapabilities get a layer with minScale to “infinity”.</span><o:p></o:p></p><p class=MsoNormal><span style='color:#1F497D'> </span><o:p></o:p></p><p class=MsoNormal><span style='color:#1F497D'>Notice that this property becomes to WMS version 1.1.1, and the server response is version 1.3.0 by default, not our case because OpenLayers use 1.1.1 if not provided.</span><o:p></o:p></p><p class=MsoNormal><span style='color:#1F497D'> </span><o:p></o:p></p><p class=MsoNormal><span style='color:#1F497D'>What do you think it could be the best solution?</span><o:p></o:p></p><p class=MsoNormal><span style='color:#1F497D'> </span><o:p></o:p></p><p class=MsoNormal><span style='color:#1F497D'>Best regards,</span><o:p></o:p></p><p class=MsoNormal><span style='color:#1F497D'> </span><o:p></o:p></p><p class=MsoNormal><span style='color:#1F497D'>Antoni</span><o:p></o:p></p><p class=MsoNormal><span style='color:#1F497D'> </span><o:p></o:p></p><p class=MsoNormal><span style='color:#1F497D'> </span><o:p></o:p></p><div><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext'>De:</span></b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext'> <a href="mailto:users-bounces@geoext.org">users-bounces@geoext.org</a> [<a href="mailto:users-bounces@geoext.org">mailto:users-bounces@geoext.org</a>] <b>En nom de </b>Alexandre Dubé<br><b>Enviat:</b> viernes, 21 de septiembre de 2012 16:42<br><b>Per a:</b> <a href="mailto:users@geoext.org">users@geoext.org</a><br><b>Tema:</b> Re: [Users] Error in WMSBrowserTreePanel.js</span><o:p></o:p></p></div></div><p class=MsoNormal> <o:p></o:p></p><div><p class=MsoNormal>Hi Antoni,<br><br> I think I found what the issue is. If you take a look at the capabilities returned by that WMS service, you'll notice a "max" attribute equal to "Infinity" inside ScaleHint nodes : <br><br><ScaleHint min="39.597980" max="Infinity"></ScaleHint><br><br> OpenLayers reads this and sets the layer minScale property to "infinity". At some point, the number of zoom levels is calculated using the min and max scales properties of the layers, which ends up equalling to "infinity". This is the line that, in the end, throws the error (in Layers.js, in calculateResolutions) :<br><br>var resolutions = new Array(numZoomLevels);<br><br> numZoomLevels equals "infinity". I think you found a bug in OpenLayers. Would you please try making a small example using your capabilities GML returned (as plain text, in a file) and use OpenLayers.Format.WMSCapabilities to read it and see if the layer minScale property is equal to "infinity" as well ? That would become a nice test-case to reproduce the issue.<br><br>Best regards,<br><br>Alexandre<br><br><br>On 12-09-21 09:02 AM, Vidal, Antoni wrote:<o:p></o:p></p></div><blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'><p class=MsoNormal>Hi list,<o:p></o:p></p><p class=MsoNormal> <o:p></o:p></p><p class=MsoNormal>I’m testing WMSBrowser example in my production server and it works fine calling some WMS servers but in some cases, it doesn’t.<o:p></o:p></p><p class=MsoNormal> <o:p></o:p></p><p class=MsoNormal>Open <a href="http://www.icc.cat/WMSBrowser/examples/WMSBrowserICC.html">http://www.icc.cat/WMSBrowser/examples/WMSBrowserICC.html</a> (it uses EPSG:23031) and try the following WMS servers:<o:p></o:p></p><p class=MsoNormal> <o:p></o:p></p><p class=MsoListParagraph style='text-indent:-18.0pt;mso-list:l0 level1 lfo2'><![if !supportLists]><span style='mso-list:Ignore'>A.<span style='font:7.0pt "Times New Roman"'> </span></span><![endif]>OK: <a href="http://sima.gencat.cat/DMAH_ws/SIMA_OGC/MapServer/WMSServer">http://sima.gencat.cat/DMAH_ws/SIMA_OGC/MapServer/WMSServer</a>? <o:p></o:p></p><p class=MsoListParagraph style='text-indent:-18.0pt;mso-list:l0 level1 lfo2'><![if !supportLists]><span style='mso-list:Ignore'>B.<span style='font:7.0pt "Times New Roman"'> </span></span><![endif]>NOT OK: <a href="http://siurana.igc.cat/arcgis/services/geotermia/amplitud_termica/MapServer/WMSServer">http://siurana.igc.cat/arcgis/services/geotermia/amplitud_termica/MapServer/WMSServer</a> <o:p></o:p></p><p class=MsoNormal> <o:p></o:p></p><p class=MsoNormal>Firebug shows an “invalid array length” produced in WMSBrowserTreePanel.js line 111, when layer must be added to previewMap...<o:p></o:p></p><p class=MsoNormal> <o:p></o:p></p><p class=MsoNormal>Maybe somebody could light me.<o:p></o:p></p><p class=MsoNormal> <o:p></o:p></p><p class=MsoNormal>Regards,<o:p></o:p></p><p class=MsoNormal> <o:p></o:p></p><p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:#0D0D0D'>Antoni Vidal</span></b><o:p></o:p></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:gray'>Unitat d'Aplicacions SIG-WEB<br><a href="http://mercuri.icc.cat/website/mob_nf/mob1/mob2/inici2.htm?CONSULTA=Institut%20Cartogr%25E0fic%20de%20Catalunya&XYADDRESS=429486:4580392"><span style='color:gray'>Institut Cartogràfic de Catalunya</span></a><br>Parc de Montjuïc, E-08038 Barcelona<br>Tel. (+34) 93 567 15 00 (ext. 3228)<br><a href="http://www.icc.cat/">www.icc.cat</a></span><o:p></o:p></p><p class=MsoNormal> <o:p></o:p></p><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'><br><br><br><br><br></span><o:p></o:p></p><pre>_______________________________________________<o:p></o:p></pre><pre>Users mailing list<o:p></o:p></pre><pre><a href="mailto:Users@geoext.org">Users@geoext.org</a><o:p></o:p></pre><pre><a href="http://www.geoext.org/cgi-bin/mailman/listinfo/users">http://www.geoext.org/cgi-bin/mailman/listinfo/users</a><o:p></o:p></pre></blockquote><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'><br><br><br><br><br></span><o:p></o:p></p><pre>-- <o:p></o:p></pre><pre>Alexandre Dubé<o:p></o:p></pre><pre>Mapgears<o:p></o:p></pre><pre><a href="http://www.mapgears.com">www.mapgears.com</a><o:p></o:p></pre></blockquote><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman , serif","serif"'><br><br><br><br></span><o:p></o:p></p><pre>-- <o:p></o:p></pre><pre>Alexandre Dubé<o:p></o:p></pre><pre>Mapgears<o:p></o:p></pre><pre><a href="http://www.mapgears.com">www.mapgears.com</a><o:p></o:p></pre></blockquote><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'><br><br><br><o:p></o:p></span></p><pre>-- <o:p></o:p></pre><pre>Alexandre Dubé<o:p></o:p></pre><pre>Mapgears<o:p></o:p></pre><pre><a href="http://www.mapgears.com">www.mapgears.com</a><o:p></o:p></pre></div></body></html>