[OpenLayers-Dev] WFS/Vector + Cluster + SelectFeature = bug?

Alexandre Dube adube at mapgears.com
Thu May 3 08:34:16 EDT 2012


Hi Jesse,

Take a look at the Cluster strategy "cluster" method, which is called on 
map "moveend" but executed only if the event has "zoomChanged" property 
set, thus on zoom change :
https://github.com/openlayers/openlayers/blob/master/lib/OpenLayers/Strategy/Cluster.js#L140

On line 172, all current features are removed and replaced by new 
features. Event though a feature at a specific position has the exact 
same properties and fid before and after zooming, they are not the same 
feature object. In your demo, see the feature id in the popup, close the 
popup, zoom, open popup on the same "feature location" -> the id is not 
the same.

One quick way to solve your issue would be to close the popup before 
zooming, otherwise you may want to keep track of the cluster "fid"s 
properties selected before zoom and use them to detect which feature has 
them after zoom to re-select it.

HTH,

Alexandre


On 12-05-02 05:46 PM, Jesse V. Griffis wrote:
> Greetings,
>
> Here's the situation:
> 1. Copied basic map setup from popup demo here:
> http://openlayers.org/dev/examples/select-feature-openpopup.html
>
> 2. Modified to include the general WMS world map, plus a sample WFS layer I am
> working with.
>
> 3. WFS layer includes BBOX + Cluster strategies.
>
> 4. Included only the SelectFeature control and activated on init. No other
> special stuff.
>
> Here's the URL, js self-contained:
> http://icf.nbtsolutions.net/test/
>
> To reproduce my issue:
>
> 1. Click any of the vector features. See the popup.
> 2. Click zoom in on the zoom bar.
> 3. Try to close the popup with the red X.
> 4. See the 'layer is null' broken js in firebug.
>
> It's coming from SelectFeature.unhighlight, line 483 (git clone'd a couple
> weeks ago).
>
> If you remove the Cluster strategy, the bug goes away.
>
> Should I report this as a bug, or send this note to the -users list to figure
> out how to do it correctly? :-)
>
> Thanks,
>
> Jesse
>


-- 
Alexandre Dubé
Mapgears
www.mapgears.com



More information about the Dev mailing list