OpenLayers OpenLayers

Ticket #685 (closed feature: fixed)

Opened 1 year ago

Last modified 11 months ago

WFS markers are drawn when layer is not in range...

Reported by: johnwebbcole Assigned to:
Priority: minor Milestone: 2.5 Release
Component: Layer.WFS Version: 2.4 RC2
Keywords: Cc:
State:

Description

Using firebug on FF2, I noticed my WFS marker layer making requests even though the layer was not in range. Upon further investigation, it appears this only happens when zooming out from a level that is in range to one that is not.

We have a test site using the trunk version of OL at http://test.hud.uai.com/hudpls/ViewMap.aspx

to duplicate, use FF2 and firebug; look at the net traffic. Pick a state/county that has available properties (Illinois/Cook for example) and zoom in until you see the properties. Zoom out until the layer goes out of range and disables, you will notice a call to the WFSProxy.ashx proxy page for that last zoom.

Attachments

wfs.inrange.patch (0.7 kB) - added by crschmidt on 08/27/07 16:30:58.

Change History

05/23/07 23:16:57 changed by crschmidt

  • milestone set to 2.5 Release.

08/27/07 16:30:58 changed by crschmidt

  • attachment wfs.inrange.patch added.

08/27/07 16:31:15 changed by crschmidt

  • keywords set to review.

Thoughts on this patch?

08/28/07 04:37:07 changed by euzuro

so i just looked at this and i think the real problem here is in Map.js

in the setCenter() function is the core place where we're doing tests on layers' inRange-ness. As we cycle through the map's overlays, we do this:

                    var inRange = layer.calculateInRange();
                    if (layer.inRange != inRange) {
                        // Layer property has changed. We are going 
                        // to call moveLayer so that the layer can be turned
                        // off or on.   
                        layer.inRange = inRange;
                        moveLayer = true;
                        this.events.triggerEvent("changelayer");
                    } else {
                        // If nothing has changed, then we only move the layer
                        // if it is visible and inrange.
                        moveLayer = (layer.visibility && layer.inRange);
                    }

Which seems wise but really it's the reason for this problem. we check if the layer's inRange-ness *changes*, and if it does, then we automatically call moveTo() on it. Really, we should check if it changes, and if the new inRange is true, then we should moveTo. If it changes and the new inRange is *false*, then we should simply call display(false) on the layer.

no? thoughts? sorry i dont have time to make a patch for this.

08/28/07 07:22:29 changed by crschmidt

moveTo is used to control the visibility. Without calling moveTo, the layer will remain displayed. Changing that is a significant change at the base level of the layer class: I think that the actual right solution is:

  • If inRange changes and is now false, we should call setVisibility(false) from within Map.moveTo
  • We should change the moveTo functions to no longer be the one to call display(false) on the layer -- this needs to be done in the Layer.js class, I think.

If we do this, so far as I can tell, it should work... ... however, I feel uncomfortable doing this change this late in a release cycle.

So, I propose that we:

  • Open a ticket to do the above for 2.6 immediately after we close out 2.5 dev
  • Make this minor change to the WFS layer for 2.5
  • Fix trunk right after the branch.

This way, we hopefully won't be fighting with tons of churn over a tiny bugfix, and we can get more debugging on it later on.

08/28/07 07:31:04 changed by euzuro

  • keywords changed from review to commit.

agreed. even though i think the patch needed would be small and simple (and actually correct this problem with *every* layer, not just wfs)... you're probably right and it's probably a can of worms and if this is good enough to fix the problem for the person who opened the ticket, then so be it.

i approve of committing your patch conditional on the creation of a new ticket for 2.6 with all the above detailed.

08/28/07 08:01:52 changed by crschmidt

  • keywords deleted.
  • status changed from new to closed.
  • resolution set to fixed.

(In [4069]) Stop WFS layer from requesting data when layer is not in range. (Closes #685) Note that this is not a complete fix, but instead a patch for 2.5: after 2.5, this should be changed/removed when map.setCenter() is fixed. (See #937)