Yes, you need to provide a complete capabilities url for the url parameter:
http://localhost:8080/geoserver/wms?SERVICE=WMS&REQUEST=GetCapabilities Also note that if your GeoServer is on the same host as your application (http://localhost:8080/ in this case), you can use /geoesrver/wms?SERVICE=WMS&REQUEST=GetCapabilities This will avoid cross domain scripting issues. Andreas. On Thu, Apr 18, 2013 at 5:54 PM, Christoph Mayrhofer <christoph.mayrho...@drei.at> wrote: > Hi François, > > I just tried it with the following code, but there are no nodes listed in > the tree. > Could the url parameter be the problem?: http://localhost:8080/geoserver/wms > > var root = new Ext.tree.AsyncTreeNode({ > text: 'All Layers', > loader: new GeoExt.tree.WMSCapabilitiesLoader({ > url: 'http://localhost:8080/geoserver/wms', > layerOptions: {buffer: 0, singleTile: true, ratio: 1}, > layerParams: {'TRANSPARENT': 'TRUE'}, > // customize the createNode method to add a checkbox to nodes > createNode: function(attr) { > attr.checked = attr.leaf ? false : undefined; > return > GeoExt.tree.WMSCapabilitiesLoader.prototype.createNode.apply(this, [attr]); > } > }) > }); > > tree = new Ext.tree.TreePanel({ > root: root, > region: 'west', > width: 250, > listeners: { > // Add layers to the map when ckecked, remove when unchecked. > // Note that this does not take care of maintaining the layer order on > the map. > 'checkchange': function(node, checked) { > if (checked === true) { > mapPanel.map.addLayer(node.attributes.layer); > } else { > mapPanel.map.removeLayer(node.attributes.layer); > } > } > } > }); > > regards, Chris > > On Thu, 18 Apr 2013 10:25:19 -0400, "Valiquette,Francois [Montreal]" > <francois.valique...@ec.gc.ca> wrote: > > Hello Chris, > > > > Yes you can, you need to make a query on your server to get the > GetCapabilities XML (a list of all the available layers and options). > > The GeoExt.data.WMSCapabilitiesStore can make the query for you by giving it > an URL. Then, it will return you a set of records. Afterward with the > records, you can generate manually a Tree for a greater flexibility. > > Otherwise, I think you can use GeoExt.tree.WMSCapabilitiesLoader to generate > the Tree automatically for you. > > > > Here is an exemple of a valid XML file : > > http://api.geoext.org/1.1/examples/data/wmscap.xml > > > François > > > > > > De : users-boun...@geoext.org [mailto:users-boun...@geoext.org] De la part > de Christoph Mayrhofer > Envoyé : 18 avril 2013 10:05 > À : users@geoext.org > Objet : [Users] Add all geoserver layers automatically > > > > Hi, > > I saw some examples that had a List of available layers and a button that > you could click to add a selected layers to the map. > Is it possible to have all layers on a Geoserver instance automatically > added to the map. > This would eliminate the need to change the JS code when a new layer is > added to Geoserver. > > regards, Chris > > > > > > _______________________________________________ > Users mailing list > Users@geoext.org > http://www.geoext.org/cgi-bin/mailman/listinfo/users > -- Andreas Hocevar OpenGeo - http://opengeo.org/ Expert service straight from the developers. _______________________________________________ Users mailing list Users@geoext.org http://www.geoext.org/cgi-bin/mailman/listinfo/users