[OpenLayers-Dev] Re: Possible bug with Protocol.HTTP

Cody Redmond codydjango at gmail.com
Wed Jun 15 14:37:46 EDT 2011


Thanks!  I already knew about featureselected -- but I must have overlooked
that extra 's'!!!!

Cody

On Tue, Jun 14, 2011 at 9:46 PM, Eric Lemoine
<eric.lemoine at camptocamp.com>wrote:

> On Tue, Jun 14, 2011 at 11:56 PM, codydjango <codydjango at gmail.com> wrote:
> >
> > In this case your callback isn't called because of the Fixed strategy.
> >> The strategy calls protocol.read and provides its own callback to the
> >> read method, so this overrides the "global" callback. If your app code
> >> does protocol.read() somewhere then your "global" callback func will
> >> get invoked.
> >
> > Hello -- I'm new to openlayers, and I've been running into some issues,
> > probably because I'm new.  One of the first things I wanted to do was
> draw a
> > box, have the server return all the features in the box, and then "do
> > something" with them.
> >
> > I thought I'd use something like this:
> >
> >        var getFeatures = new OpenLayers.Control.GetFeature({
> >            box: true,
> >            click: false,
> >            multiple: true,
> >            protocol: new OpenLayers.Protocol.HTTP({
> >                url: '/obj',
> >                format: new OpenLayers.Format.GeoJSON(),
> >                params: {
> >                    limit: 2000
> >                }
> >            })
> >        });
> >
> > What is the best way to set a custom callback to go off once their is
> > response data to work with?
>
> The control triggers "featuresselected" events when features are received.
>
>        var getFeatures = new OpenLayers.Control.GetFeature({
>            box: true,
>            click: false,
>            multiple: true,
>            protocol: new OpenLayers.Protocol.HTTP({
>                url: '/obj',
>                format: new OpenLayers.Format.GeoJSON(),
>                params: {
>                    limit: 2000
>                }
>             }),
>            eventListeners: {
>                featuresselected: function(e) {
>                    // do something with e.features
>                }
>            }
>        });
>
>
> --
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-dev/attachments/20110615/b9e9cd26/attachment.html


More information about the Dev mailing list