[OpenLayers-Users] GetFeatureInfo requests never get answers

Marc Desharnais marc.desharnais at ec.gc.ca
Fri Jul 13 16:03:29 EDT 2007


Hi all,

I'm new to this mailing list. I work for the government of Canada on a 
project to develop visualization tools.
I tried to adapt the example from

http://www.openlayers.org/dev/examples/getfeatureinfo.html


To get the getfeatureInfo working. I get the loading message in the div 
section 'nodeList'. The problem is that it never seems to get an answer.
I get the checkpoint popup when I click the map so I guess that this 
part is executed well. But it stays forever with the loading message.
So probably "wmsLayer1.getFullRequestString" is not correct or my 
database is not quite right... I just have a layer with points.
And I want to query information about thoise points in the database to 
display it beside the map.

I'm using a local Geoserver with PostGIS. I would like to know too how 
the getFeatureInfo query works.
Like if I have anything I have to do specially into the database. I 
figure that it's querying the database for info, but what info?
Do I have to define what I want to be queried?  Maybe this is off-topic 
here sorry.

I searched for informations on the UTIL package for openlayers but 
didn't find real documentation about that.

Please let me know if you would like more info.


Any help will be greatly appreciated.
Thanks in advance





/******* CODE START HERE - !!! Note that this code is not complete. I 
posted only the parts I found relevant. !!!
  function init(){

          var map = new OpenLayers.Map($('map'), {controls:[]} );
          OpenLayers.IMAGE_RELOAD_ATTEMPTS = 5;
         
          
          var yahooLayer = new OpenLayers.Layer.Yahoo( "Globe (Yahoo)", 
{reproject: "true"} );
          
          map.addLayer(yahooLayer);
          

          var wmsLayer1 = new OpenLayers.Layer.WMS(
                "POSTGIS villes", 
"http://ulysse.cmc.ec.gc.ca:8081/geoserver/wms",
          {
             layers: 'topp:villes',
             format: 'image/png' , transparent: "true", reproject: "true"}
          );
                   

          map.addLayer(wmsLayer1);
          

          map.addControl(new OpenLayers.Control.LayerSwitcher());

          map.addControl(new OpenLayers.Control.NavToolbar());
          map.addControl(new OpenLayers.Control.PanZoomBar($('map')));
    
          map.addControl(new OpenLayers.Control.MouseDefaults());
          map.addControl(new OpenLayers.Control.Scale($('scale')));
          map.addControl(new OpenLayers.Control.MousePosition({element: 
$('position')}));

          map.events.register('click', map, function (e) {
                OpenLayers.Util.getElement('nodeList').innerHTML = 
"<b>Téléchargement d'information...<br> Veuillez Attendre SVP...</b>";
                var url =  wmsLayer1.getFullRequestString({
                   REQUEST: "GetFeatureInfo",
                   EXCEPTIONS: "application/vnd.ogc.se_xml",
                   BBOX: wmsLayer1.map.getExtent().toBBOX(),
                   X: e.xy.x,
                   Y: e.xy.y,
                   INFO_FORMAT: 'text/html',
                   QUERY_LAYERS: wmsLayer1.params.LAYERS,
                   WIDTH: wmsLayer1.map.size.w,
                   HEIGHT: wmsLayer1.map.size.h});
                   OpenLayers.loadURL(url, '', this, setHTML);

                   alert("Checkpoint");

                   Event.stop(e);
             });


       }
              
       function setHTML(response) {
          alert("before answer");
          OpenLayers.Util.getElement('nodeList').innerHTML = 
response.responseText;
          alert("after answer");
       }

/********* CODE STOPS HERE



More information about the Users mailing list