Discussion:
[OpenLayers-Users] display results of WMSgetfeatureinfo
Dan Lear
2011-10-28 11:36:39 UTC
Permalink
Hi,

I have code to generate a WMSGetFeatureInfo request which works fine:

getInfo = new OpenLayers.Control.WMSGetFeatureInfo({
url: 'http://MY_URL/geoserver/dassh/wms',
title: 'identify features on click',
layers: [dasshData],
queryVisible: true
});
getInfo.infoFormat = 'text/html';
getInfo.events.register("getfeatureinfo", this, getResults);
map.addControl(getInfo);
getInfo.activate();

function getResults(e) {

document.getElementById('resultTxt').innerHTML = e.text;

}

and I have a div tag "resultTxt" that I want the returned information displayed in, but it is blank (as is e.text)


I can't capture the response and get it in the div, and looking at Firebug I can open the getfeatureinfo in a new tab and display the table but the firebug link is red, even though it reports a 200 OK status.

Any help?

Thanks
Dan
l***@online.de
2011-10-28 12:44:55 UTC
Permalink
Hi Dan,

if you try to query data cross-domain you could use a proxy to achieve what you like (or have your service running on the same machine as your geoserver).

look here:
http://docs.openlayers.org/library/request.html

http://trac.osgeo.org/openlayers/wiki/FrequentlyAskedQuestions#ProxyHost

Hope this helps.
João




Hi,

I have code to generate a WMSGetFeatureInfo request which works fine:

getInfo = new OpenLayers.Control.WMSGetFeatureInfo({
url: 'http://MY_URL/geoserver/dassh/wms',
title: 'identify features on click',
layers: [dasshData],
queryVisible: true
});
getInfo.infoFormat = 'text/html';
getInfo.events.register("getfeatureinfo", this, getResults);
map.addControl(getInfo);
getInfo.activate();

function getResults(e) {

document.getElementById('resultTxt').innerHTML = e.text;

}

and I have a div tag "resultTxt" that I want the returned information displayed
in, but it is blank (as is e.text)


I can't capture the response and get it in the div, and looking at Firebug I
can open the getfeatureinfo in a new tab and display the table but the firebug
link is red, even though it reports a 200 OK status.

Any help?

Thanks
Dan
Dan Lear
2011-10-28 12:56:53 UTC
Permalink
Thanks João,

But geoserver and apache/openlayers are on the same machine, that said, I added the proxy information and it all worked.

Thanks very much for your help,
Dan



-----Original Message-----
From: ***@online.de [mailto:***@online.de]
Sent: 28 October 2011 13:45
To: Dan Lear; openlayers-***@lists.osgeo.org
Subject: RE: [OpenLayers-Users] display results of WMSgetfeatureinfo

Hi Dan,

if you try to query data cross-domain you could use a proxy to achieve what you like (or have your service running on the same machine as your geoserver).

look here:
http://docs.openlayers.org/library/request.html

http://trac.osgeo.org/openlayers/wiki/FrequentlyAskedQuestions#ProxyHost

Hope this helps.
João




Hi,

I have code to generate a WMSGetFeatureInfo request which works fine:

getInfo = new OpenLayers.Control.WMSGetFeatureInfo({
url: 'http://MY_URL/geoserver/dassh/wms',
title: 'identify features on click',
layers: [dasshData],
queryVisible: true
});
getInfo.infoFormat = 'text/html';
getInfo.events.register("getfeatureinfo", this, getResults);
map.addControl(getInfo);
getInfo.activate();

function getResults(e) {

document.getElementById('resultTxt').innerHTML = e.text;

}

and I have a div tag "resultTxt" that I want the returned information displayed
in, but it is blank (as is e.text)


I can't capture the response and get it in the div, and looking at Firebug I
can open the getfeatureinfo in a new tab and display the table but the firebug
link is red, even though it reports a 200 OK status.

Any help?

Thanks
Dan
_______________________________________________
Users mailing list
***@lists.osgeo.org
http://lists.osgeo.org/mailm
l***@online.de
2011-10-28 13:09:03 UTC
Permalink
Hi Dan,

yes, you're right! I forgot, the port the geoserver is responding to requests is also involved in the domain recognition. Therefore it could help using mod_jk with geoservers jetty engine to be able to omit the port when requesting the FeatureInfos (instead of using ProxyHost).... I've to confess that I'm not sure if the response will have a port number or not, which eventually again could cause the browser security concerns.

João


----- UrsprÃŒngliche Nachricht -----
Von: Dan Lear
Gesendet: 28.10.11 14:56 Uhr
An: ***@online.de, openlayers-***@lists.osgeo.org
Betreff: RE: [OpenLayers-Users] display results of WMSgetfeatureinfo

Thanks João,

But geoserver and apache/openlayers are on the same machine, that said, I added the proxy information and it all worked.

Thanks very much for your help,
Dan



-----Original Message-----
From: ***@online.de [mailto:***@online.de]
Sent: 28 October 2011 13:45
To: Dan Lear; openlayers-***@lists.osgeo.org
Subject: RE: [OpenLayers-Users] display results of WMSgetfeatureinfo

Hi Dan,

if you try to query data cross-domain you could use a proxy to achieve what you like (or have your service running on the same machine as your geoserver).

look here:
http://docs.openlayers.org/library/request.html

http://trac.osgeo.org/openlayers/wiki/FrequentlyAskedQuestions#ProxyHost

Hope this helps.
João




Hi,

I have code to generate a WMSGetFeatureInfo request which works fine:

getInfo = new OpenLayers.Control.WMSGetFeatureInfo({
url: 'http://MY_URL/geoserver/dassh/wms',
title: 'identify features on click',
layers: [dasshData],
queryVisible: true
});
getInfo.infoFormat = 'text/html';
getInfo.events.register("getfeatureinfo", this, getResults);
map.addControl(getInfo);
getInfo.activate();

function getResults(e) {

document.getElementById('resultTxt').innerHTML = e.text;

}

and I have a div tag "resultTxt" that I want the returned information displayed
in, but it is blank (as is e.text)


I can't capture the response and get it in the div, and looking at Firebug I
can open the getfeatureinfo in a new tab and display the table but the firebug
link is red, even though it reports a 200 OK status.

Any help?

Thanks
Dan
Arnie Shore
2011-10-28 14:38:07 UTC
Permalink
Folks, I vaguely recall an announcement of a capability to accomplish
the above, mebbe about a year ago. Did I dream that?

I totally forget any of the details of what's involved, but there was a
free product involved, IIRC. Thanks for any information.
Arnie Shore
2011-10-28 16:00:56 UTC
Permalink
Found it => http://wiki.openstreetmap.org/wiki/Potlatch_2

AS
Post by Arnie Shore
Folks, I vaguely recall an announcement of a capability to accomplish
the above, mebbe about a year ago. Did I dream that?
I totally forget any of the details of what's involved, but there was a
free product involved, IIRC. Thanks for any information.
_______________________________________________
Loading...