[OpenLayers-Users] How it works WMSGetFeatureInfo??

Francesc Cañas kikocanas at gmail.com
Fri Feb 3 04:04:43 EST 2012


Hi,

I want to use this control but i don't know how... I've found the same
information in all forums and tutorials but it doesn't work. What's wrong?
I've tried with diferents options and there's no way.


With pop-up:

info = new OpenLayers.Control.WMSGetFeatureInfo({
            url: 'http://localhost:8080/geoserver/Proj_CAT/wms',
            title: 'Identify features by clicking',
            queryVisible: true,
            eventListeners: {
                getfeatureinfo: function(event) {
                    map.addPopup(new OpenLayers.Popup.FramedCloud(
                        "chicken",
                        map.getLonLatFromPixel(event.xy),
                        null,
                        event.text,
                        null,
                        true
                    ));
                }
            }
        });
        map.addControl(info);
        info.activate();


With text:

infoControls = {
            click: new OpenLayers.Control.WMSGetFeatureInfo({
                url: 'http://demo.opengeo.org/geoserver/wms',
                title: 'Identify features by clicking',
                layers: [water],
                queryVisible: true
            }),
            hover: new OpenLayers.Control.WMSGetFeatureInfo({
                url: 'http://demo.opengeo.org/geoserver/wms',
                title: 'Identify features by clicking',
                layers: [water],
                hover: true,
                // defining a custom format options here
                formatOptions: {
                    typeName: 'water_bodies',
                    featureNS: 'http://www.openplans.org/topp'
                },
                queryVisible: true
            })
        }

infoControls.click.activate();
function showInfo(evt) { $('responseText').innerHTML = evt.text;}

And in the body: <div id="responseText"></div>


There's still more options and I've tried some of them with the same
result: The map is displayed but I can't display the layer info when I
click.

Thanks!

-- 
http://kikocanas.blogspot.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20120203/888d969a/attachment.html


More information about the Users mailing list