[OpenLayers-Users] RE : general question
James Leveille
James_Leveille at dmr.ca
Wed Apr 1 13:34:06 EDT 2009
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: users-bounces at openlayers.org de la part de k_karo at web.de
Date: mer. 01-04-09 11:07
À: users at openlayers.org
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
Users at openlayers.org
http://openlayers.org/mailman/listinfo/users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20090401/7085e29f/attachment.html
More information about the Users
mailing list