[OpenLayers-Dev] Issue with BBox resfactor and Vector Layer redraw() in v2.12

Alex Cassells ACassells at integrated-skills.com
Mon Mar 19 16:58:25 EDT 2012


I am fairly new to OpenLayers and mapping in general but I have quite a lot of js experience.  I am not sure if this is the correct forum to raise this but I have been doing some investigation of some OpenLayers behaviors and I thought I would raise what are some possible issues.  It is all to do with resymbolising (restyling) vector layers and whether they reload data and whether the resymbolisation takes affect.

This was prompted by a stack overflow question on OpenLayers http://stackoverflow.com/questions/9768430/openlayers-redraw-vector-layer-without-downloading-data-again/9770999#9770999

It seems that there is an issue (with both v2.11 and v2.12) if you set the BBox strategy resFactor to 1 and then resymbolise and redraw the Layer you will always refresh the data from the server.  This is because the BBox strategy logic infers (wrongly in my opinion) that the data is invalid and needs to be refreshed.  I am happy looking at this and suggesting a possible fix for this but this raised potentially a larger issue with v2.12.  If you try to resymbolise a vector layer and then use layer.redraw() to redraw the layer with the new style in v2.12 the redraw does nothing, previously the layer.redraw() function would show the new styling of the vector features.  In v2.12 you have to do something like pan the map to make the changes take affect.  I presume this is a bug and the redraw() function should show the layer with new symbols on the map (please forgive me if I am wrong about this).

I have created a few test maps that illustrate these problems http://93.174.142.184/openlayerstest/index.htm



More information about the Dev mailing list