[OpenLayers-Users] removeFeatures + Cluster Strategy

Heidt, Christopher M. CHRISTOPHER.M.HEIDT at saic.com
Wed Apr 1 10:43:44 EDT 2009


Yep, that's a much better solution.
Thank you :) 

-----Original Message-----
From: bartvde at osgis.nl [mailto:bartvde at osgis.nl] 
Sent: Wednesday, April 01, 2009 10:40 AM
To: Heidt, Christopher M.
Cc: users at openlayers.org
Subject: Re: [OpenLayers-Users] removeFeatures + Cluster Strategy

Hi,

I haven't tested this, but try:

clusterStrategy.clearCache();
featureLayer.destroyFeatures(featureLayer.features);

Best regards,
Bart

> Ok, to help anybody who also comes across this issue, you seem to have 
> to do the following:
>
> clusterStrategy.deactivate();
> featureLayer.destroyFeatures(featureLayer.features);
> clusterStrategy.activate();
>
> If you don't deactivate the cluster strategy before removing your 
> features then, for some reason, the cluster strategy will still think 
> they are there and will contienue to make new clusters everytime you 
> change your zoom level.
>
> Anybody know how to fix this so I don't have to toggle strategy 
> activation?
>
>
> -----Original Message-----
> From: users-bounces at openlayers.org 
> [mailto:users-bounces at openlayers.org]
> On Behalf Of Heidt, Christopher M.
> Sent: Wednesday, April 01, 2009 9:39 AM
> To: Alexandre Dube
> Cc: users at openlayers.org
> Subject: Re: [OpenLayers-Users] removeFeatures + Cluster Strategy
>
> It seems to have the same behavior whether I use removeFeature or 
> destroyFeature.
> The features vanish correctly until I change my zoom lvl, then they 
> all reappear.
> They even contienue to dynamically cluster themselves.
>
>
> -----Original Message-----
> From: Alexandre Dube [mailto:adube at mapgears.com]
> Sent: Wednesday, April 01, 2009 9:10 AM
> To: Heidt, Christopher M.
> Cc: users at openlayers.org
> Subject: Re: [OpenLayers-Users] removeFeatures + Cluster Strategy
>
> Hi,
>
> Try _featureLayer.destroyFeatures(_featureLayer.features) instead.
>
> Regards,
>
> Alexandre
>
> Heidtmare wrote:
>> first i do this:
>>
>> function _createFeatures(records)
>> 	{
>> 		var features = [];
>> 		var wktFormat = new OpenLayers.Format.WKT({
>> 			externalProjection: _map.displayProjection,
>> 			internalProjection: _map.projection
>> 		});
>> 		Ext.each(records, function(record){
>> 			var feature = wktFormat.read(record.get('featureGeom'));
>> 			feature.id = record.get('featureId');
>> 			features.push(feature);
>> 		});
>> 		_featureLayer.addFeatures(features);
>> 	}
>> and it works great.
>>
>>
>> later i do this:
>>
>> _featureLayer.removeFeatures(_featureLayer.features);
>>
>> and my feature clusters disappear as expected...until i change my 
>> zoom level, then they all come back.
>> how do i kill the clusters once and for all!
>>
>>
>>
>
>
> --
> Alexandre Dubé
> Mapgears
> www.mapgears.com
>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>





More information about the Users mailing list