[OpenLayers-Users] WMSCapabilities parse problem

maxho kaospostage at gmail.com
Tue Mar 2 05:29:53 EST 2010


Hi.

I'm trying to parse WMS GetCapabilities response to get LegendURLs. 
I started with sample from http://trac.openlayers.org/ticket/1176 and was
able to read "version" property.
However I can't read "Service" and "Capability" nodes of response. They show
up as undefined in firebug console.
I tried Openlayers 2.8 and latest nightly build.
Here is my piece of code:

var request = OpenLayers.Request.GET({
	url:
"http://apps1.gdr.nrcan.gc.ca/cgi-bin/worldmin_en-ca_ows?request=GetCapabilities&service=WMS&version=1.1.1",
	success: function(response) {
		var XMLformat = new OpenLayers.Format.XML();
		var xml = XMLformat.read(response.responseText);
		var CAPformat = new OpenLayers.Format.WMSCapabilities();
		var cap = CAPformat.read(xml);
		window.console.log("Capabilities: " + cap);
		window.console.log("Capabilities.version: " + cap.version);
		window.console.log("Capabilities.service: " + cap.service);
		window.console.log("Capabilities.capability: " + cap.capability);
	}
});

What's wrong with my code?
-- 
View this message in context: http://n2.nabble.com/WMSCapabilities-parse-problem-tp4660147p4660147.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.



More information about the Users mailing list