WFS layer - mergeNewParams

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

WFS layer - mergeNewParams

Pierre GIRAUD
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 ?


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.

Regards

Pierre
_______________________________________________
Dev mailing list
[hidden email]
http://openlayers.org/mailman/listinfo/dev
Reply | Threaded
Open this post in threaded view
|

Re: WFS layer - mergeNewParams

Tim Schaub-2
Hey Pierre-

Pierre GIRAUD wrote:
> 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.
>

Please add this description to the ticket opened some time ago for this
issue:
http://trac.openlayers.org/ticket/699


> Any thougts about that ?
>
>
> 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.
>
> Regards
>
> Pierre
> _______________________________________________
> Dev mailing list
> [hidden email]
> http://openlayers.org/mailman/listinfo/dev

_______________________________________________
Dev mailing list
[hidden email]
http://openlayers.org/mailman/listinfo/dev
Reply | Threaded
Open this post in threaded view
|

Re: WFS layer - mergeNewParams

Erik Uzureau-3
In reply to this post by Pierre GIRAUD
On 6/26/07, Pierre GIRAUD <[hidden email]> 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
> [hidden email]
> http://openlayers.org/mailman/listinfo/dev
>
_______________________________________________
Dev mailing list
[hidden email]
http://openlayers.org/mailman/listinfo/dev