I'm working on a specialized browser-based editing app based on openlayers 4. I'm displaying features (pictures, data Elements, docs) from a few source Layers which are geo referenced, using drag & drop, etc. and a server based datastorage. Some of thes features are in the same location, others close together. These items should be selected and dragged individually, but while not selected, they should be display as a 'cluster' with e.g. a folder icon.

  1. I'd like to have a hover which explode the cluster to display the original Features and a linked line to the original Point. And make the original features selectable.

  2. Then, if an item is selected, the others should collapse to the cluster/folder-icon and the selected item shows on top of it.

  3. If the item is deselected, then it disappears in the folder.

  4. If the original Feature is moved or edited the original Data should be updated.

I took a look at the cluster source but ran in many difficulties. They first was: I'd like to cluster over a view vector Sources, with different behaviour and styles of their features. It wasn't that complicated to extend the ol.source.Cluster with the ability to handle a collection of VectorSources, including a addSource and a dropSource function (I'll make it available when it is finished and maybe useful), but I'm not happy with it. The double layer of features makes it confusing and creates the need to distinguish between clustered and unclustered features, nearly everywhere, resulting logicaly in an ol.clusterFeature object

I also created Select and Modify Interactions but they work only with plain VectorSources, but nut with clustered ones. Because there is the need to handle both, the clusterFeature and the originalFeatures. The cluster breaks the other mechanism of editing - or show me where I'm wrong...

So I'm not happy with this approach of handling displaying of closed located features. While thinking of it, the thought grows to me that it is not a data source problem, but something related to the view and rendering. Together with the question how to arrange the overlapping feature-display-areas.

Where is the Point to start in ol4, when I'd like to implement some clustering and arrange display-areas for viewing the data the described way?

Or what do you think is best practise to reach my goals with ol4?

Ervin Peters

Your Answer

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

Browse other questions tagged or ask your own question.