I've done something to allow a user to add a WMS on the fly.
Here's a few clues :
- I ask the user for the URL
- http request to get the capabilities
- from the answer to the getCapabilities, a pick up the title and the available
layer(s) - something like :
var xmlFormat = new OpenLayers.Format.XML();
var xml = xmlFormat.read(oHttpRequest.responseText);
var capFormat = new OpenLayers.Format.WMSCapabilities_1_1_1();
var cap = capFormat.read(xml);
// title
myTitle=cap.service.title;
// layers
for (var i=0; i<cap.capability.layers.length;i++)
{
...
}
- the user selects the layer(s) of interest (I use the ItemSelector to do so)
- selected layer(s) is(are) added to the map (title previously extracted is
used)
biggest problem I had :
- reading the XML returned for the getCapabilities with IE6
hope it helps
James Léveillé
________________________________
De: [email protected] de la part de [email protected]
Date: mer. 01-04-09 11:07
À: [email protected]
Objet : [OpenLayers-Users] general question
Hello,
Is it possible with openlayers, that a user can add a WMS on the fly? Can
OpenLayers be extended to act more like a geoportal? Or is it only meant for
visualisation of preconfigurated wms?
Thanks!
_______________________________________________________________________
DSL zum Nulltarif + 20 Euro Extraprämie bei Online-Bestellung über die
DSL Freundschaftswerbung! http://dsl.web.de/?ac=OM.AD.AD008K15279B7069a
_______________________________________________
Users mailing list
[email protected]
http://openlayers.org/mailman/listinfo/users
_______________________________________________
Users mailing list
[email protected]
http://openlayers.org/mailman/listinfo/users