[OpenLayers-Users] getCapabilities

Helmut Seidel M.A. info at knowhow-la.de
Tue Jun 11 07:26:24 PDT 2013


Hello everybody,

 

sorry - this could be a newby question:

 

I tryed the following code to retrive the capabilities of a wms-Layer:

 

<head>

<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />

                <title>getCapabilities Test</title>

                

                <script type="text/javascript"
src="OpenLayers/lib/OpenLayers.js"></script>

 

                <script type="text/javascript">

                               function init(){

                                               var request =
OpenLayers.Request.GET({

                url: "http://geodaten.bayern.de/ogc/ogc_dop200_oa.cgi",

            success: function(response){

                var format = new OpenLayers.Format.XML();

                var xml = format.read(response.responseText

 

                                               var CAPformat = new
OpenLayers.Format.WMSCapabilities.v1_1_1();

                                                               var cap =
CAPformat.read(xml);

                                                               

                for (var i=0; i < cap.capability.layers.length; i++) 

                                                               {

                               layer = cap.capability.layers[i];

 

 
alert(layer.name);

                                                               }

                                               }

                               });

                               }

                </script>

</head>

 

<body onload="init();">

 

</body>

 

 

Firebug tells me:

 

TypeError: cap.capability is undefined

for (var i=0; i < cap.capability.layers.length; i++)

 

 

I can't see whats wrong - can anybody help?

 

Thanks again

 

 

 

---

KnowHow - Helmut Seidel M.A.

Softwareentwicklung & Coaching

 

Gabelsbergerstraße 17 B

84034 Landshut

Telefon: 0871 9665230

Internet: www.knowhow-la.de

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20130611/819cf84e/attachment.html>


More information about the Users mailing list