[OpenLayers-Dev] WFS layer - mergeNewParams

Erik Uzureau erik.uzureau at metacarta.com
Mon Jul 9 14:41:06 EDT 2007


On 6/26/07, Pierre GIRAUD <bluecarto at gmail.com> wrote:
> As I can see, the WFS layer does have any mergeNewParams method.
>
> I tried to create one using something similar to the WMS.Untiled one
> but I encounter some problems.
>
>
> Openlayers.Layers.WFS.prototype.mergeNewParams:function(newParams) {
>         var upperParams = OpenLayers.Util.upperCaseObject(newParams);
>         var newArguments = [upperParams];
>         OpenLayers.Layer.HTTPRequest.prototype.mergeNewParams.apply(this,
>                                                                  newArguments);
>         //redraw
>         this.moveTo(null, true);
>     }
>
>
> I tried to call this when the zoom changes but in some cases the I get
> a javascript error. This is due to the fact that the wfs tile may be
> destroyed before the ajax resquest response is received. When the
> request response is received, the requestSuccess callback is called
> but some objects or properties don't exist anymore.
> I think that the destroy method in Tile.WFS should also cancel the ajax request.
>
> Any thougts about that ?

This is a valid concern and a damn good bug find. I've made a ticket:
http://trac.openlayers.org/ticket/820

and we'll get to this as soon as possible. I've also added in the
comment what I think would be a pretty straightforward fix if you need
that in the meantime.

>
>
> One other problem is that I would like to change the layer parameters
> as soon as the zoomLevel changes. I can't find any map event that
> tells that the zoom level is changing and what will be the next zoom
> level before the layers are updated.
>

There is an event on the map called "zoomend" that is fired whenever
there is a change of zoom. Unfortunately, it is fired *after* the
layers themselves have already been updated.

Erik


> Regards
>
> Pierre
> _______________________________________________
> Dev mailing list
> Dev at openlayers.org
> http://openlayers.org/mailman/listinfo/dev
>



More information about the Dev mailing list