[OpenLayers-Users] Format/parse WMSGetFeatureInfo GML

jdmorgan jdmorgan at unca.edu
Fri Sep 14 07:03:40 PDT 2012


Hello,
I am using the WMSGetFeatureInfo funciton to return information about various layers in my OpenLayers web app.  I recieve the gml back well enough however, i was wondereing if there is an easy way to format this GML for display in a bubble box or something along those popup lines. I am hoping that I don't have to write a GML parser.  Here is my code as it is now:

function identify(){ for (var i = 0; i < map.layers.length; i++) { test 
= map.layers[i].name; } info = new 
OpenLayers.Control.WMSGetFeatureInfo({ url: url, title: 'Identify 
features by clicking', layers: [map.layers[1],map.layers[2]], 
queryVisible: true, }); info.events.register("getfeatureinfo", this, 
pickInfo); info.infoFormat = 'application/vnd.ogc.gml'; 
map.addControl(info); info.activate(); } function pickInfo(e){
alert(e.text);
map.addPopup(new OpenLayers.Popup.FramedCloud(
"Feature Info:",
map.getLonLatFromPixel(e.xy),
null,
e.text,
null,
true
));
}

Cheers,
Derek

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20120914/708c6389/attachment.html>


More information about the Users mailing list