Nice work. If you can parse a getCapabilities response, then there is a good chance you are very close to being able to parse a Web Map Context (WMC) document too. A WMC provides an XML list of WMS layers.
And if you go down this path, you might want to look at the Mapbuilder code which has WMC parsing and OWS Context parsing too. OWS Context includes layers from other sources too: GML, GeoRSS, WFS, etc. Of note, it hasn't been approved by the OGC yet. Lorenzo Becchi wrote: > Hi devs, > I've worked a little bit on the WMSManager and that's the live example: > http://www.ominiverdi.org/openlayers/sandbox/openlayers/examples/wms_manager.html > > > Main Features: > * Parse GetCapabilites from listed servers and show layers to add to the > map. > * Permalink updated to store map views even if layers are from different > servers > * QueryByPoint features extending the NavToolbar to allow queries on > queriable layers (signed with a "(q)"). > * extended legend > > Compatibility: > * Firefox - complete > * Internet Explorer - complete (has problems to parse some > GetCapabilities XML) > * Safari - all functions except adding layers (due to a strange behavior > on server select) > > every function listed above can be refined for sure. I'll do my best. > > the Ticket for WMSManager is this: > http://trac.openlayers.org/ticket/687 > > Hope somebody can help me solving IE XML parsing problem (WMSManager.js > line 862) and Safari select issue (WMSManager.js line 674). > Otherwise I'll go on "crying alone" > :-) > > > Code available here (SVN): > http://dev.openlayers.org/sandbox/ominiverdi/ > > Usage - sample script (openlayers/examples/wms_manager.html): > ------------------------------------------------------------ > > <html xmlns="http://www.w3.org/1999/xhtml"> > <head> > <style type="text/css"> > #map { > width: 800px; > height: 475px; > border: 1px solid black; > } > #queryOut { > width:800px;height: 200px; > border: 1px solid black; > position:absolute;left:10px; > top:500px;overflow:auto; > } > </style> > > <script src="../lib/OpenLayers.js"></script> > <script type="text/javascript"> > <!-- > > var map; > > function init(){ > > //proxy is needed to access external > server GetCapabilities > > OpenLayers.ProxyHost = "/cgi-bin/proxy.cgi?url="; > > //add map object > map = new OpenLayers.Map( $('map') ); > > //create the array of WMS servers (['server > title','http://server.url']) > var aWMSServers=new Array( > ['OpenLayers > WMS','http://labs.metacarta.com/cgi-bin/mapserv?map=/www/labs/map/vmap0.map'],//content > type: application/vnd.ogc.wms_xml > ['World - NASA Blue Marble Next > Generation','http://wms.jpl.nasa.gov/wms.cgi?'], > ['World - Demis World > Map','http://www2.demis.nl/mapserver/Request.asp?'], > ['AU - Aims > Australia','http://adc.aims.gov.au:9555/atlas/SstWmsServer?'], > ['BR - Unidades de Conservacao do Brasil (dados > preliminares)','http://mapas.mma.gov.br/cgi-bin/mapserv?map=/opt/www/html/webservices/ucs.map&'] > ); > > //add legend and WMS Server panels > map.addControl( new OpenLayers.Control.WMSManager(aWMSServers ) > ); > > //add Toolbar > var queryTarget = $('queryOut'); > WMSToolbar = new OpenLayers.Control.WMSToolbar({queryTarget: > queryTarget}); > map.addControl(WMSToolbar); > > //add Permalink > map.addControl(new OpenLayers.Control.WMSPermalink()); > > } > // --> > </script> > </head> > <body onload="init()"> > <div id="map"></div> > <div id="queryOut"></div> > </body> > </html> > > ------------------------------------------------------------ > > ciao > Lorenzo > > _______________________________________________ > Dev mailing list > [email protected] > http://openlayers.org/mailman/listinfo/dev > > -- Cameron Shorter Systems Architect, http://lisasoft.com.au Tel: +61 (0)2 8570 5050 Mob: +61 (0)419 142 254 _______________________________________________ Dev mailing list [email protected] http://openlayers.org/mailman/listinfo/dev
