[OpenLayers-Users] getCapabilities

Bart van den Eijnden bartvde at opengeo.org
Tue Jun 11 07:35:23 PDT 2013


Your url is not a GetCapabilities request, use e.g.:

http://geodaten.bayern.de/ogc/ogc_dop200_oa.cgi?service=WMS&request=GetCapabilities&version=1.1.1

Also, you don't need the Format.XML in between, the code will handle that for you, and use OpenLayers.Format.WMSCapabilities, the format will see what the version is of the GetCapabilities output.

Best regards,
Bart

-- 
Bart van den Eijnden
OpenGeo - http://opengeo.org
Expert service straight from the developers.



On Jun 11, 2013, at 4:26 PM, Helmut Seidel M.A. <info at knowhow-la.de> wrote:

> 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
>  
> _______________________________________________
> Users mailing list
> Users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-users

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


More information about the Users mailing list