[OpenLayers-Users] Jquery Mobile - WMSGetFeatureInfo crashes
Mark Volz
volzmark at yahoo.com
Mon Jan 2 14:17:49 EST 2012
Hello,
I have been trying to get the Mobile Jquery Demo to work with my own data. Currently, I am trying to configure the application so that when a user clicks, the application will identify using WMSGetFeatureInfo as opposed to getting information from the sprinters layer. Openlayers is crashing when I try to display the results of WMSGetFeatureInfo. Has anyone had any luck configuring WMSGetFeatureInfo with the Mobile JQuery? If someone could help me, I would appreciate it. Thank You!
With help I have thus far:
* The click event to call WMSGetFeatureInfo
* Openlayers calls GeoServer to get WMSGetFeatureInfo
* The click event is registered to call a function named ShowWMSInfo
Unfortunately Openlayers crashes in the ShowWMSInfo, which is where I am trying to display the results from geoserver
Here is the code that I have thus far changed in mobile-base.js
#1 Changed the select control to use WMSGetFeatureInfo
//var selectControl = new OpenLayers.Control.SelectFeature(sprintersLayer, {
// autoActivate:true,
// onSelect: onSelectFeatureFunction});
// ** updated selectControl code**
var selectControl = new OpenLayers.Control.WMSGetFeatureInfo({
url: 'http://demo.opengeo.org/geoserver/wms',
title: 'Identify features by clicking',
layers: [water],
queryVisible: true,
autoActivate:true
//onSelect: onSelectFeatureFunction
});
#2 Registered the recoded select control from #1 to call a function called ShowWMSInfo.
selectControl.events.register("getfeatureinfo", this, ShowWMSInfo);
#3 NOT WORKING - On each click the ShowWMSInfo function is called. According to firebug, GeoServer is returning a result for WMSGetFeatureInfo. However, I cannot figure out how to display the results in openlayers.
function ShowWMSInfo(e) {
var html = '<table class="getfeatureinfo">';
var html += '<tr><th colspan=2" class="layerTitle">' + "</th><th></th><tr>"
if (e.features && e.features.length) {
var val = e.features[0].attributes.id;
document.getElementById('WATER_TYPE').value = val;
}
return html += '</td></tr>'';
return html;
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20120102/2723db58/attachment.html
More information about the Users
mailing list