[OpenLayers-Users] WFSGetFeatureInfo and OpenLayers.Popup.FramedCloud

Raffaele Morelli raffaele.morelli at gmail.com
Fri May 10 06:46:36 PDT 2013


2013/5/10 Gery . <gamejihou at hotmail.com>

>
> Hi Raffaele,
>
> I think the WMS request is always sent. One idea could be that you add
> some if/else inside the current if loop or elseif to prevent sending the
> request, something like:
>


the request being made is not really a problem

BTW but that conditional statement doesn't work here, event.feature.length
is equal to 0 but nothing is being showed, chrome console shows that
everything works on wms request, ie the response is correctly sent to the
browser.

the problem is that event.features.length is always 0

code:

        var info = new OpenLayers.Control.WMSGetFeatureInfo({
            url: 'wmsserver',
            title: 'Identify features by clicking',
            queryVisible: true,
            eventListeners: {
                getfeatureinfo: function(event) {
                    var l = event.features.length;
                    alert(event.features.length+"-"+l)
                    if( event.features.length > 0 )
                    {
                            map.addPopup(new OpenLayers.Popup.FramedCloud(
                                "sostegno",
                                map.getLonLatFromPixel(event.xy),
                                null,
                                event.text,
                                null,
                                true
                            ));
                    }
                }
            }
        });
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20130510/3ffef96b/attachment.html>


More information about the Users mailing list