[OpenLayers-Users] How do you "unregister" a getFeatureInfo request?

Eric Lemoine eric.lemoine at camptocamp.com
Wed Sep 23 03:33:03 EDT 2009


On Mon, Sep 21, 2009 at 7:45 PM, cgp <carina_palanca at forcorp.com> wrote:
>
> I have the click event registered like this:
>
>>>>>
>                map.events.register('click', map, function (e) {
>                        var params = {  REQUEST: "GetFeatureInfo",
>                                                EXCEPTIONS: "application/vnd.ogc.se_xml",
>                                                BBOX: map.getExtent().toBBOX(),
>                                                X: e.xy.x,
>                                                Y: e.xy.y,
>                                                INFO_FORMAT: 'text/html',
>                                                QUERY_LAYERS: layer_info,
>                                                FEATURE_COUNT: 50,
>                                                Styles: '',
>                                                Layers: layer_info,
>                                                srs: 'EPSG:900913',
>                                                WIDTH: map.size.w,
>                                                HEIGHT: map.size.h,
>                                                format: 'image/png'     };
>                        OpenLayers.loadURL("http://app-serv-01-uat/geoserver/wms", params, this,
> setHTML, setHTML);
>                        OpenLayers.Event.stop(e);
>                });
>
> But I only want the click event to happen if the layer is currently visible
> (i.e. if it is checked in the Layer Switcher). Otherwise, if the user is not
> currently viewing the layer, then the getFeatureInfo request should not be
> called.

can't you just check layer.getVisibility() in the "click" callback?

-- 
Eric Lemoine

Camptocamp France SAS
Savoie Technolac, BP 352
73377 Le Bourget du Lac, Cedex

Tel : 00 33 4 79 44 44 96
Mail : eric.lemoine at camptocamp.com
http://www.camptocamp.com


More information about the Users mailing list