[OpenLayers-Users] Removing features from a cluster

Xavier Mamano (jorix) xavier.mamano at gmail.com
Thu Jan 16 13:01:49 PST 2014


Hi,

> Can you continuously add features to a clustered layer and have it
> re-cluster each time a new feature is added? 
Yes (using CenteredCluster.js)

> ... replacing the previous feature with the new ...
Oops! If CenteredCluster.js strategy is off change a feature and then
activate, there is no problem. Otherwise it is necessary to think... I
believe it would work, if after a feature change the method refreshCache is
called (not tested).



dnbphysicist wrote
> Thanks Xavier, I will take a look at that.
> 
> Another question about clustering: Can you continuously add features to a
> clustered layer and have it re-cluster each time a new feature is added?
> I'm having an issue where it's just replacing the previous feature with
> the
> new one and I'm wondering if it's something I'm doing.
> 
> Thanks in advance!
> 
> 
> On Wed, Jan 15, 2014 at 1:15 PM, Xavier Mamano (jorix) <

> xavier.mamano@

>> wrote:
> 
>> Hi,
>>
>> This is not supported by the OL standard. Some time ago I wrote some code
>> to
>> adjust issues in Cluster strategy, I think this problem is also solved in
>> my
>> code.
>>
>> Try use:
>>
>>
>> https://github.com/jorix/OL-Ragbag/blob/gh-pages/lib/Ragbag/Strategy/CenteredCluster.js
>>
>> See example:
>>
>>
>> http://jorix.github.io/OL-Ragbag/examples/strategy-centered-cluster-add-remove.html
>> This example allows dynamically add points, and enable/disable the
>> Cluster
>> strategy. But only deletes the entire cluster (while strategy is
>> enabled),
>> otherwise it should work with the js (while Cluster strategy is active in
>> the layer are clusters that contains a array of features --named
>> cluster--)
>>
>> > but it seems the strategy itself keeps a cache of the features.
>> Yes, named teatures. In this aspect disable cluster works differently
>> than
>> OL staqndad code, the features of the layer are restored.
>>
>> Xavier
>>
>>
>> dnbphysicist wrote
>> > Hello all, I've done some searching on Google of this, but haven't
>> found
>> a
>> > good way to accomplish it yet. I have a map that allows other
>> applications
>> > to add and remove layers and features from it dynamically. If a vector
>> > layer is clustered and another application goes to delete one or more
>> of
>> > the features in the cluster, obviously the remove features function is
>> not
>> > going to work. Is there a good way to do this? I tried iterating over
>> all
>> > of the clusters, and then the features in that cluster but it seems the
>> > strategy itself keeps a cache of the features. I also tried
>> deactivating
>> > the strategy, but it seems that just causes the layer to retain the
>> > clusters as features and no longer expands or contracts with zoom ins
>> and
>> > outs (not surprisingly). Any help would be greatly appreciated.
>> >
>> > Thanks in advance!
>> >
>> > _______________________________________________
>> > Users mailing list
>>
>> > Users at .osgeo
>>
>> > http://lists.osgeo.org/mailman/listinfo/openlayers-users
>>
>>
>>
>>
>>
>> --
>> View this message in context:
>> http://osgeo-org.1560.x6.nabble.com/Removing-features-from-a-cluster-tp5098224p5098245.html
>> Sent from the OpenLayers Users mailing list archive at Nabble.com.
>> _______________________________________________
>> Users mailing list
>> 

> Users at .osgeo

>> http://lists.osgeo.org/mailman/listinfo/openlayers-users
>>
> 
> 
> 
> -- 
> *HYX*
> http://hyx-music.com
> 
> _______________________________________________
> Users mailing list

> Users at .osgeo

> http://lists.osgeo.org/mailman/listinfo/openlayers-users





--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Removing-features-from-a-cluster-tp5098224p5098495.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.


More information about the Users mailing list