This is a first implementation of a connector for OL to add on the fly WMS layers from different servers.
A simple select shows WMS server list. Once a server is selected, GetCapabilities is asked and parsed (normally Proxy needed) and a new select appears with the list of title of each available layer.
Selecting a Layer will automatically add that layer to the legend and, once clicked, the layer will be shown.
More features have to come:
- imagetype selector (dealing with overlays)
- projection chooser
- ecc.
suggestions are welcome.
live example
a demo is available here:
http://www.ominiverdi.org/openlayers/examples/wms_manager.html
usage example
var map;
function init(){
OpenLayers.ProxyHost = "/cgi-bin/proxy.cgi?url=";
map = new OpenLayers.Map( $('map') );
var aWMSServers=new Array(
['Metacarta','http://labs.metacarta.com/wms/vmap0'],
['NASA Blue Marble Next Generation','http://wms.jpl.nasa.gov/wms.cgi?']
);
map.addControl( new OpenLayers.Control.WMSManager(aWMSServers) );