To limit the number of features requested, I have used OpenLayers BBox Strategy with ratio of 0.5. The problem is, when I pan the map a new set of features are displayed and the older features are removed. Is there any way to keep those older features when new features are requested?


Seriously - what do you want them for? That might help with answers.

Just one idea would be to have a second "clone"/cache layer. As soon as your BBox layer loads data, your clone the content to a 2nd permanent layer. So over time, your "cache" layer ends up acquiring all the data loaded on the bbox layer.

Implementation is fairly simple - wait for loadend and then copy data. maybe remove duplicates by tracking IDs. And then of course hide all the features on the "cache" layer. But...what's the point?

  • The point: i need to keep track of the features that i have changed(or simply click), which i do by assigning new color. The problem: after every pan, new features are loaded even those which are already existing in the view port, but the color changes back to default. this way i cannot know which were changed. – neogeomat Mar 17 '13 at 7:25
  • if you're actually changing them, then send the data down to the server, save it, and when it's time to render the data, have the server return the data with some "modified" flag and you Style it as appropriate on the client. – Vadim Mar 19 '13 at 2:36
  • 1
    it takes some time to render modified data, so during that time it has to be shown as "marked for modification". After modification there will be entirely different styling. – neogeomat Mar 19 '13 at 4:11
  • then set a higher BBox ratio so your features don't get destroyed when they are out of view. Otherwise you have to come up with something else. Either don't use BBox or clone points to another layer. – Vadim Mar 19 '13 at 4:34
  • ya, i think so too. i am tired of trying new ways like the Paging strategy, still haven't figured out theory of how it works. – neogeomat Mar 19 '13 at 8:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.