<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:'times new roman', 'new york', times, serif;font-size:12pt"><div style="color: black; font-family: 'times new roman', 'new york', times, serif; font-size: 12pt; ">Hi Ivan,</div><div style="color: black; font-family: 'times new roman', 'new york', times, serif; font-size: 12pt; "><br></div><div style="color: black; font-family: 'times new roman', 'new york', times, serif; font-size: 12pt; ">This thing is making me mad. I have spent more than two days on this things still its not working. My display projection is mercator but my WMS layer from where i want to get info is in espg:4326. </div><div style="color: black; font-family: 'times new roman', 'new york', times, serif; font-size: 12pt; "><br></div><div style="color: black; font-family: 'times new roman', 'new york', times, serif; font-size: 12pt; ">I am trying this in two ways:</div><div
style="color: black; font-family: 'times new roman', 'new york', times, serif; font-size: 12pt; "><br></div><div><font class="Apple-style-span" face="'times new roman', 'new york', times, serif" size="3">1) </font><font class="Apple-style-span" face="'times new roman', 'new york', times, serif"> </font></div><div><font class="Apple-style-span" face="'times new roman', 'new york', times, serif"><span class="Apple-tab-span" style="white-space:pre">        </span>info = new OpenLayers.Control.WMSGetFeatureInfo({</font></div><div><font class="Apple-style-span" face="'times new roman', 'new york', times, serif"><span> url: '<a target="_blank" href="http://geoweb.hft-stuttgart.de:80/geoserver/wms">http://geoweb.hft-stuttgart.de:80/geoserver/wms</a>', </span></font></div><div><font class="Apple-style-span" face="'times new roman', 'new york', times, serif"> title:
'Identify features by clicking',</font></div><div><font class="Apple-style-span" face="'times new roman', 'new york', times, serif"> layers: [wmslayer],</font></div><div><font class="Apple-style-span" face="'times new roman', 'new york', times, serif"> //hover:true,</font></div><div><font class="Apple-style-span" face="'times new roman', 'new york', times, serif"> queryVisible: true,</font></div><div><font class="Apple-style-span" face="'times new roman', 'new york', times, serif"> eventListeners: {</font></div><div><font class="Apple-style-span" face="'times new roman', 'new york', times, serif"> getfeatureinfo: function(event) {</font></div><div><font class="Apple-style-span" face="'times new roman', 'new york', times, serif">
<span class="Apple-tab-span" style="white-space:pre">        </span></font></div><div><font class="Apple-style-span" face="'times new roman', 'new york', times, serif"> map.addPopup(new OpenLayers.Popup.FramedCloud(</font></div><div><font class="Apple-style-span" face="'times new roman', 'new york', times, serif"> "chicken", </font></div><div><font class="Apple-style-span" face="'times new roman', 'new york', times, serif"> map.getLonLatFromPixel(event.xy),</font></div><div><font class="Apple-style-span" face="'times new roman', 'new york', times, serif"> null,</font></div><div><font
class="Apple-style-span" face="'times new roman', 'new york', times, serif"> event.text,</font></div><div><font class="Apple-style-span" face="'times new roman', 'new york', times, serif"> null,</font></div><div><font class="Apple-style-span" face="'times new roman', 'new york', times, serif"> true</font></div><div><font class="Apple-style-span" face="'times new roman', 'new york', times, serif"> ));</font></div><div><font class="Apple-style-span" face="'times new roman', 'new york', times, serif"> //alert(event.text);</font></div><div><font class="Apple-style-span"
face="'times new roman', 'new york', times, serif"> </font></div><div><font class="Apple-style-span" face="'times new roman', 'new york', times, serif"> }</font></div><div><font class="Apple-style-span" face="'times new roman', 'new york', times, serif"> }</font></div><div><font class="Apple-style-span" face="'times new roman', 'new york', times, serif"> </font></div><div><font class="Apple-style-span" face="'times new roman', 'new york', times, serif"> });</font></div><div><font class="Apple-style-span" face="'times new roman', 'new york', times, serif"> map.addControl(info);</font></div><div><font class="Apple-style-span" face="'times new roman', 'new york', times, serif">
info.activate();</font></div><div><font class="Apple-style-span" face="'times new roman', 'new york', times, serif"><br></font></div><div><font class="Apple-style-span" face="'times new roman', 'new york', times, serif">There are point feautures in my WMS. WMS is congfigured in ESPG:4326 in my geoserver. When i click to a point, the point information is passed in projectionMercator or projection4326 ? I think this is where the problem lies ! To work correctly the point information should be passed in ESPG: 4326 but i dont see a parameter in </font><span class="Apple-style-span" style="font-family: 'times new roman', 'new york', times, serif; ">OpenLayers.Control.WMSGetFeatureInfo where i can set this . I always get blank reponse !</span></div><div><span class="Apple-style-span" style="font-family: 'times new roman', 'new york', times, serif; "><br></span></div><div><span class="Apple-style-span" style="font-family: 'times new roman', 'new
york', times, serif; "><br></span></div><div><span class="Apple-style-span" style="font-family: 'times new roman', 'new york', times, serif; ">2) Geoserver way.</span></div><div><span class="Apple-style-span" style="font-family: 'times new roman', 'new york', times, serif; "><br></span></div><div><div><font class="Apple-style-span" face="'times new roman', 'new york', times, serif"> map.events.register('click', map, function (e) {</font></div><div><font class="Apple-style-span" face="'times new roman', 'new york', times, serif"> //document.getElementById('nodelist').innerHTML = "Loading... please wait...";</font></div><div><font class="Apple-style-span" face="'times new roman', 'new york', times, serif"> var params = {</font></div><div><font class="Apple-style-span" face="'times new roman', 'new york', times,
serif"> REQUEST: "GetFeatureInfo",</font></div><div><font class="Apple-style-span" face="'times new roman', 'new york', times, serif"> EXCEPTIONS: "application/vnd.ogc.se_xml",</font></div><div><font class="Apple-style-span" face="'times new roman', 'new york', times, serif"> BBOX: map.getExtent().transform(map.getProjectionObject(),projection4326).toBBOX(),</font></div><div><font class="Apple-style-span" face="'times new roman', 'new york', times, serif"> X: e.xy.x,</font></div><div><font class="Apple-style-span" face="'times new roman', 'new york', times, serif">
Y: e.xy.y,</font></div><div><font class="Apple-style-span" face="'times new roman', 'new york', times, serif"> INFO_FORMAT: 'text/html',</font></div><div><font class="Apple-style-span" face="'times new roman', 'new york', times, serif"> QUERY_LAYERS: 'test_postgis:addressv2b',</font></div><div><font class="Apple-style-span" face="'times new roman', 'new york', times, serif"> FEATURE_COUNT: 50,</font></div><div><font class="Apple-style-span" face="'times new roman', 'new york', times, serif"> Layers: 'test_postgis:addressv2b',</font></div><div><font class="Apple-style-span" face="'times new roman', 'new
york', times, serif"> Styles: '',</font></div><div><font class="Apple-style-span" face="'times new roman', 'new york', times, serif"> WIDTH: map.size.w,</font></div><div><font class="Apple-style-span" face="'times new roman', 'new york', times, serif"> HEIGHT: map.size.h,</font></div><div><font class="Apple-style-span" face="'times new roman', 'new york', times, serif"> format: 'image/jpeg'};</font></div><div><font class="Apple-style-span" face="'times new roman', 'new york', times, serif"><span> OpenLayers.loadURL("<a target="_blank"
href="http://geoweb.hft-stuttgart.de:80/geoserver/wms">http://geoweb.hft-stuttgart.de:80/geoserver/wms</a>", params, this, setHTML, setHTML);</span></font></div><div><font class="Apple-style-span" face="'times new roman', 'new york', times, serif"> //OpenLayers.Event.stop(e);</font></div><div><font class="Apple-style-span" face="'times new roman', 'new york', times, serif"> });</font></div><div><font class="Apple-style-span" face="'times new roman', 'new york', times, serif"> </font></div><div><font class="Apple-style-span" face="'times new roman', 'new york', times, serif"> </font></div><div><font class="Apple-style-span" face="'times new roman', 'new york', times, serif"> // sets the HTML provided
into the nodelist element</font></div><div><font class="Apple-style-span" face="'times new roman', 'new york', times, serif"> function setHTML(response){</font></div><div><font class="Apple-style-span" face="'times new roman', 'new york', times, serif"> <span class="Apple-tab-span" style="white-space:pre">        </span></font></div><div><font class="Apple-style-span" face="'times new roman', 'new york', times, serif"> <span class="Apple-tab-span" style="white-space:pre">        </span> map.addPopup(new OpenLayers.Popup.FramedCloud(</font></div><div><font class="Apple-style-span" face="'times new roman', 'new york', times, serif"> "chicken", </font></div><div><font class="Apple-style-span" face="'times new roman', 'new york', times, serif">
map.getLonLatFromPixel(event.xy), </font></div><div><font class="Apple-style-span" face="'times new roman', 'new york', times, serif"> null,</font></div><div><font class="Apple-style-span" face="'times new roman', 'new york', times, serif"> response.responseText,</font></div><div><font class="Apple-style-span" face="'times new roman', 'new york', times, serif"> null,</font></div><div><font class="Apple-style-span" face="'times new roman', 'new york', times, serif">
true</font></div><div><font class="Apple-style-span" face="'times new roman', 'new york', times, serif"> ));</font></div><div><font class="Apple-style-span" face="'times new roman', 'new york', times, serif"> <span class="Apple-tab-span" style="white-space:pre">        </span></font></div><div><font class="Apple-style-span" face="'times new roman', 'new york', times, serif"> <span class="Apple-tab-span" style="white-space:pre">        </span></font></div><div><font class="Apple-style-span" face="'times new roman', 'new york', times, serif"> <span class="Apple-tab-span" style="white-space:pre">        </span></font></div><div><font class="Apple-style-span" face="'times new roman', 'new york', times, serif"> <span class="Apple-tab-span"
style="white-space:pre">        </span></font></div><div><font class="Apple-style-span" face="'times new roman', 'new york', times, serif"> //document.getElementById('nodelist').innerHTML = response.responseText;</font></div><div><font class="Apple-style-span" face="'times new roman', 'new york', times, serif"> };</font></div><div><span class="Apple-tab-span" style="white-space: pre; "><font class="Apple-style-span" face="'times new roman', 'new york', times, serif">                </font></span></div></div><div><span class="Apple-tab-span" style="white-space: pre; "><font class="Apple-style-span" face="'times new roman', 'new york', times, serif"><br></font></span></div><div><span class="Apple-tab-span" style="white-space: pre; "><font class="Apple-style-span" face="'times new roman', 'new york', times, serif"><br></font></span></div><div><span class="Apple-tab-span"
style="white-space: pre; "><font class="Apple-style-span" face="'times new roman', 'new york', times, serif">But this ones says, "event is not defined ".</font></span></div><div><span class="Apple-tab-span" style="white-space: pre; "><font class="Apple-style-span" face="'times new roman', 'new york', times, serif"><br></font></span></div><div><span class="Apple-tab-span" style="white-space: pre; "><font class="Apple-style-span" face="'times new roman', 'new york', times, serif">Please help me with this </font></span></div><div><span class="Apple-tab-span" style="white-space: pre; "><font class="Apple-style-span" face="'times new roman', 'new york', times, serif"><br></font></span></div><div><span class="Apple-tab-span" style="white-space: pre; "><font class="Apple-style-span" face="'times new roman', 'new york', times, serif">sukuchha</font></span></div><div style="color: black; font-family: 'times new roman', 'new york', times, serif; font-size: 12pt;
"><br><div style="font-family:arial, helvetica, sans-serif;font-size:13px"><font size="2" face="Tahoma"><hr size="1"><b><span style="font-weight: bold;">Von:</span></b> Ivan Grcic <ivan.grcic@geo-solutions.it><br><b><span style="font-weight: bold;">An:</span></b> Sukuchha Shrestha <sukuchha@yahoo.de>; geoserver-users <geoserver-users@lists.sourceforge.net><br><b><span style="font-weight: bold;">Gesendet:</span></b> Freitag, den 6. Mai 2011, 19:12:50 Uhr<br><b><span style="font-weight: bold;">Betreff:</span></b> Re: [OpenLayers-Users] Get Feature Info in pop up from geoserver<br></font><br>Hi,<br><br>it seems that for some reason you are not getting any features back<br>from you geoserver. (are you sure there are some features at requested<br>point?)<br><br>This can also happen due to several things, but most likely your layer<br>is not configured with correct spatial reference system, so geoserver<br>doesnt return any feature at
requested point.<br><br>Cheers,<br>Ivan<br><br>On Fri, May 6, 2011 at 5:59 PM, Sukuchha Shrestha <<a ymailto="mailto:sukuchha@yahoo.de" href="mailto:sukuchha@yahoo.de">sukuchha@yahoo.de</a>> wrote:<br>> Hello ivan,<br>> Thank you very much for pointing me towards the righ path. I tried to apply<br>> as shown in that html but but i ran into the problem again.<br>> Somehow my pop is not returning the get feature info but empty. I tried to<br>> see with firebug and i found that the geoserver is actually returning<br>> something.<br>> <html><br>> <head><br>> <title>Geoserver GetFeatureInfo output</title><br>> </head><br>> <style type="text/css"><br>> table.featureInfo, table.featureInfo td, table.featureInfo th {<br>> border:1px solid #ddd;<br>> border-collapse:collapse;<br>> margin:0;<br>> padding:0;<br>> font-size: 90%;<br>>
padding:.2em .1em;<br>> }<br>> table.featureInfo th {<br>> padding:.2em .2em;<br>> font-weight:bold;<br>> background:#eee;<br>> }<br>> table.featureInfo td{<br>> background:#fff;<br>> }<br>> table.featureInfo tr.odd td{<br>> background:#eee;<br>> }<br>> table.featureInfo caption{<br>> text-align:left;<br>> font-size:100%;<br>> font-weight:bold;<br>> text-transform:uppercase;<br>> padding:.2em .2em;<br>> }<br>> </style><br>> <body><br>><br>> </body><br>> </html><br>> I guess this is header template that is there is geoserver. Ideally it<br>> should come with content templete as well.<br>> Any idea what is the problem here.<br>> Thanks<br>> Sukuchha<br>> ________________________________<br>> Von: Ivan Grcic <<a ymailto="mailto:ivan.grcic@geo-solutions.it"
href="mailto:ivan.grcic@geo-solutions.it">ivan.grcic@geo-solutions.it</a>><br>> An: Sukuchha Shrestha <<a ymailto="mailto:sukuchha@yahoo.de" href="mailto:sukuchha@yahoo.de">sukuchha@yahoo.de</a>><br>> CC: <a ymailto="mailto:users@openlayers.org" href="mailto:users@openlayers.org">users@openlayers.org</a><br>> Gesendet: Freitag, den 6. Mai 2011, 11:02:29 Uhr<br>> Betreff: Re: [OpenLayers-Users] Get Feature Info in pop up from geoserver<br>><br>> Hi Sukuchha,<br>><br>> You should use openlayers popup feature.<br>><br>> This example is perfect for you :<br>> <a href="http://openlayers.org/dev/examples/getfeatureinfo-popup.html" target="_blank">http://openlayers.org/dev/examples/getfeatureinfo-popup.html</a><br>><br>> Regards,<br>> Ivan<br>><br>> On Fri, May 6, 2011 at 10:49 AM, Sukuchha Shrestha <<a ymailto="mailto:sukuchha@yahoo.de"
href="mailto:sukuchha@yahoo.de">sukuchha@yahoo.de</a>><br>> wrote:<br>>> Hello nice people,<br>>> i am trying to display get feature info of WMS layers coming from my<br>>> geoserver. I do not have much experience with open layers and geoserver as<br>>> well.<br>>> This is what geoserver preview layers give to me:<br>>> // support GetFeatureInfo<br>>> map.events.register('click', map, function (e) {<br>>> document.getElementById('nodelist').innerHTML =<br>>> "Loading... please wait...";<br>>> var params = {<br>>> REQUEST: "GetFeatureInfo",<br>>>
EXCEPTIONS: "application/vnd.ogc.se_xml",<br>>> BBOX: map.getExtent().toBBOX(),<br>>> X: e.xy.x,<br>>> Y: e.xy.y,<br>>> INFO_FORMAT: 'text/html',<br>>> QUERY_LAYERS: map.layers[0].params.LAYERS,<br>>> FEATURE_COUNT: 50,<br>>> Layers: 'sf:bugsites',<br>>>
Styles: '',<br>>> WIDTH: map.size.w,<br>>> HEIGHT: map.size.h,<br>>> format: format};<br>>><br>>> OpenLayers.loadURL("<a href="http://localhost:8080/geoserver/wms" target="_blank">http://localhost:8080/geoserver/wms</a>", params, this,<br>>> setHTML, setHTML);<br>>> OpenLayers.Event.stop(e);<br>>> });<br>>> }<br>>> function setHTML(response){<br>>>
document.getElementById('nodelist').innerHTML =<br>>> response.responseText;<br>>> };<br>>><br>>> But in my case, I want to display the getfeatureinfo not in a external div<br>>> but on a openlayers right beside the where user have clicked. If, any one<br>>> could provide me a working code to do this and explain in a coincise<br>>> manner<br>>> ??<br>>> Sorry if this is too basic stuff for some people ! I am in class 1 of<br>>> openlayers and geoserver :))<br>>> Sukuchha<br>>><br>>> _______________________________________________<br>>> Users mailing list<br>>> <a ymailto="mailto:Users@lists.osgeo.org" href="mailto:Users@lists.osgeo.org">Users@lists.osgeo.org</a><br>>> <a href="http://lists.osgeo.org/mailman/listinfo/openlayers-users"
target="_blank">http://lists.osgeo.org/mailman/listinfo/openlayers-users</a><br>>><br>>><br>><br>><br>><br>> --<br>> -------------------------------------------------------<br>> Ivan Grcic<br>> GeoSolutions S.A.S.<br>> Software Engineer<br>><br>><br>> Via Poggio alle Viti 1187<br>> 55054 Massarosa (LU)<br>> Italy<br>><br>> phone: +39 0584 962313<br>> fax: +39 0584 962313<br>><br>> <a href="http://www.geo-solutions.it" target="_blank">http://www.geo-solutions.it</a><br>> <a href="http://geo-solutions.blogspot.com/" target="_blank">http://geo-solutions.blogspot.com/</a><br>> <a href="http://twitter.com/geosolutions_it" target="_blank">http://twitter.com/geosolutions_it</a><br>> <a href="http://www.youtube.com/user/GeoSolutionsIT" target="_blank">http://www.youtube.com/user/GeoSolutionsIT</a><br>><br>>
-------------------------------------------------------<br>><br><br><br><br>-- <br>-------------------------------------------------------<br>Ivan Grcic<br>GeoSolutions S.A.S.<br>Software Engineer<br><br><br>Via Poggio alle Viti 1187<br>55054 Massarosa (LU)<br>Italy<br><br>phone: +39 0584 962313<br>fax: +39 0584 962313<br><br><a href="http://www.geo-solutions.it" target="_blank">http://www.geo-solutions.it</a><br><a href="http://geo-solutions.blogspot.com/" target="_blank">http://geo-solutions.blogspot.com/</a><br><a href="http://twitter.com/geosolutions_it" target="_blank">http://twitter.com/geosolutions_it</a><br><a href="http://www.youtube.com/user/GeoSolutionsIT" target="_blank">http://www.youtube.com/user/GeoSolutionsIT</a><br><br>-------------------------------------------------------<br></div></div><div style="color: black; font-family: 'times new roman', 'new york', times, serif; font-size: 12pt; position: fixed;
"></div>
</div></body></html>