[OpenLayers-Users] getCapabilities
Helmut Seidel M.A.
info at knowhow-la.de
Tue Jun 11 08:24:32 PDT 2013
Hello again,
Ive changed the code to someting like:
function init(){
var request = OpenLayers.Request.GET({
url:
"http://geodaten.bayern.de/ogc/ogc_dop200_oa.cgi?service=WMS&request=GetCapa
bilities&version=1.1.1",
success: function(response){
var format = new
OpenLayers.Format.WMSCapabilities();
var xml = request.responseXML;
var capabilities = format.read(xml);
for (var i=0; i < capabilities.layers.length;
i++) {
layer =
capabilities.layers[i];
alert(layer.name);
}
}
});
}
But that does not really improve things, so I guess thats not what youve
meant- sorry Im really new to OpenLayers.
Thanks again
Helmut
Von: Bart van den Eijnden [mailto:bartvde at opengeo.org]
Gesendet: Dienstag, 11. Juni 2013 16:35
An: Helmut Seidel M.A.
Cc: openlayers-users at lists.osgeo.org
Betreff: Re: [OpenLayers-Users] getCapabilities
Your url is not a GetCapabilities request, use e.g.:
http://geodaten.bayern.de/ogc/ogc_dop200_oa.cgi?service=WMS
<http://geodaten.bayern.de/ogc/ogc_dop200_oa.cgi?service=WMS&request=GetCapa
bilities&version=1.1.1> &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 <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
<mailto: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>
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: <http://www.knowhow-la.de> www.knowhow-la.de
_______________________________________________
Users mailing list
<mailto:Users at lists.osgeo.org> Users at lists.osgeo.org
<http://lists.osgeo.org/mailman/listinfo/openlayers-users>
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/311f0c94/attachment-0001.html>
More information about the Users
mailing list