Hi all,

I wish to update my problem in hope to get more precise help.
I checked what is returned by the server and every time and do a manual attempt by entering the request URL myself I get "no features were found".
Is it because of the server or from OpenLayers?
I tried to change the name of the layer in the reuqest to something random, and I received a message telling that the feature type was not found.

So I guess that it is querying the server with something that exists. But it can't get any feature from the database. Again, if anyone has any experience of OpenLayers getting layers from geoserver with PostGIS, please tell me if there is anything to do in the database to make ot work.


Thank you :)

Marc


Tim Schaub wrote:
Hey Marc-

Marc Desharnais wrote:
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.

Since you are making an asynchronous request for the GetFeatureInfo results, you are subject to the same origin policies that browsers enforce.

This means that your GetFeatureInfo request won't go anywhere unless it is requested with the same protocol, from the same port, and on the same host as the request that initiated your application (see [1]).

If this sounds like your issue (i.e. you are making the request to GeoServer on a different port than the request for the rest of your application), see the FAQ on setting up a proxy host [2]. Note that if you are using the proxy.cgi that comes in the OL examples directory, you will need to add your host (and port) to the accepted list (in proxy.cgi).


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.

Also, use Firebug to watch the requests go out. Copy the request and paste in to a new tab to make sure you are getting what you expect. If you don't get what you expect, then you'll have to troubleshoot your GeoServer configuration.

Hope that helps some,
Tim

[1] http://www.mozilla.org/projects/security/components/same-origin.html
[2] http://trac.openlayers.org/wiki/FrequentlyAskedQuestions#ProxyHost



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
_______________________________________________
Users mailing list
[email protected]
http://openlayers.org/mailman/listinfo/users



_______________________________________________
Users mailing list
[email protected]
http://openlayers.org/mailman/listinfo/users

Reply via email to