[Users] Error in WMSBrowserTreePanel.js
Vidal, Antoni
antoni.vidal at icc.cat
Fri Sep 28 08:41:24 CEST 2012
Hi Alexandre,
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.
Old code:
layerPreview = layer.clone();
mapPanelPreview.map.addLayer(layerPreview);
My code:
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"});
mapPanelPreview.map.addLayer(newLayer);
Thanks for your attetion,
Antoni Vidal
Unitat d'Aplicacions SIG-WEB
Institut Cartogràfic de Catalunya <http://mercuri.icc.cat/website/mob_nf/mob1/mob2/inici2.htm?CONSULTA=Institut%20Cartogr%25E0fic%20de%20Catalunya&XYADDRESS=429486:4580392>
Parc de Montjuïc, E-08038 Barcelona
Tel. (+34) 93 567 15 00 (ext. 3228)
www.icc.cat <http://www.icc.cat/>
De: Alexandre Dubé [mailto:adube at mapgears.com]
Enviat: martes, 25 de septiembre de 2012 17:46
Per a: Vidal, Antoni
A/c: GeoEXT Users
Tema: Re: [Users] Error in WMSBrowserTreePanel.js
Antoni,
Please, include the list in CC.
At this point, I'm not sure what could be done to solve the issue.
Alexandre
On 12-09-25 10:15 AM, Vidal, Antoni wrote:
Hi Alexander,
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.
Look at:
layerPreview.mergeNewParams(
{'LAYERS': [layerPreview.params.LAYERS]}
);
console.info(layerPreview);
layerPreview.minScale = null;
layerPreview.maxScale = null;
layerPreview.resolutions = [275,100,50,25,10,5,2,1,0.5,0.25];
layerPreview.numZoomLevels = 10;
layerPreview.maxResolution = 275;
console.info(layerPreview);
mapPanelPreview.map.addLayer(layerPreview);
The first cosole.info shows “Infinity” in minScale and null next properties. The second, shows the new values but error persist.
I don’t understand at all...
Any other suggestion ?
Thanks a lot,
Antoni.
De: Alexandre Dubé [mailto:adube at mapgears.com]
Enviat: martes, 25 de septiembre de 2012 14:50
Per a: Vidal, Antoni; GeoEXT Users
Tema: Re: [Users] Error in WMSBrowserTreePanel.js
Hi Antoni,
I added the list in CC.
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 :
getParams: function(node) {
return {'service': 'WMS', 'request': 'GetCapabilities'};
},
You could try to override this method :
GeoExt.tree.WMSCapabilitiesLoader.prototype.getParams = function(node) {
return {'service': 'WMS', 'request': 'GetCapabilities', 'version': '1.1.1'};
};
HTH,
Alexandre
On 12-09-25 08:36 AM, Vidal, Antoni wrote:
Hi Alexander,
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”.
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.
What do you think it could be the best solution?
Best regards,
Antoni
De: users-bounces at geoext.org [mailto:users-bounces at geoext.org] En nom de Alexandre Dubé
Enviat: viernes, 21 de septiembre de 2012 16:42
Per a: users at geoext.org
Tema: Re: [Users] Error in WMSBrowserTreePanel.js
Hi Antoni,
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 :
<ScaleHint min="39.597980" max="Infinity"></ScaleHint>
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) :
var resolutions = new Array(numZoomLevels);
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.
Best regards,
Alexandre
On 12-09-21 09:02 AM, Vidal, Antoni wrote:
Hi list,
I’m testing WMSBrowser example in my production server and it works fine calling some WMS servers but in some cases, it doesn’t.
Open http://www.icc.cat/WMSBrowser/examples/WMSBrowserICC.html (it uses EPSG:23031) and try the following WMS servers:
A. OK: http://sima.gencat.cat/DMAH_ws/SIMA_OGC/MapServer/WMSServer?
B. NOT OK: http://siurana.igc.cat/arcgis/services/geotermia/amplitud_termica/MapServer/WMSServer
Firebug shows an “invalid array length” produced in WMSBrowserTreePanel.js line 111, when layer must be added to previewMap...
Maybe somebody could light me.
Regards,
Antoni Vidal
Unitat d'Aplicacions SIG-WEB
Institut Cartogràfic de Catalunya <http://mercuri.icc.cat/website/mob_nf/mob1/mob2/inici2.htm?CONSULTA=Institut%20Cartogr%25E0fic%20de%20Catalunya&XYADDRESS=429486:4580392>
Parc de Montjuïc, E-08038 Barcelona
Tel. (+34) 93 567 15 00 (ext. 3228)
www.icc.cat <http://www.icc.cat/>
_______________________________________________
Users mailing list
Users at geoext.org
http://www.geoext.org/cgi-bin/mailman/listinfo/users
--
Alexandre Dubé
Mapgears
www.mapgears.com
--
Alexandre Dubé
Mapgears
www.mapgears.com
--
Alexandre Dubé
Mapgears
www.mapgears.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.geoext.org/pipermail/users/attachments/20120928/e8893159/attachment-0001.htm
More information about the Users
mailing list