Sunday 19 January 2020

OpenLayers GeoJSON Data Store



Background: I have a single geoJSON data object that backs multiple Vector Layers of its features. I do this because the feature data has many attributes and can be presented in many different ways, and by having multiple layers, I can quickly switch between visualizations.


My issue comes into play when I update the data in the corresponding backing-data store. Since the features were only loaded once (Strategy.fixed), they do not see the updates to the underlying store, and instead retain the properties they were initially loaded with.


I was hoping there was a strategy or eventing mechanism already created that I can alert my layers that it's underlying data has changed and to refresh it's features as required. As of now, I have to either a) update each feature in each of my layers and then redraw those that changed or b) remove and add all the features on each of my layers for them to see the changes.


I imagine that the Refresh strategy could somehow be of assistance, but that would bring it's own issues (namely intervals instead of instant updates and the need more for more than just inline geojson object declarations).


Thanks for any help or suggestions.




No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...