[OpenLayers-Users] Add features to a clustering layer on interval
Heidt, Christopher M.
CHRISTOPHER.M.HEIDT at saic.com
Wed Apr 1 14:03:08 EDT 2009
i use this layer:
_clusterStrategy = new OpenLayers.Strategy.Cluster({distance:20})
_featureLayer = new OpenLayers.Layer.Vector(" Features of Interest",{
projection: _map.projection,
styleMap: featureStyles,
strategies: [_clusterStrategy]
});
and i have a store that pulls from the server and then adds the records
to the layer above with this function:
function _createFeatures(records, animate)
{
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);
}
this works great the first time i get records, but i have an interval
running that polls my server
for new stuff and then i call the function above to add those to the map
as well.
the issue is that it seems to be impossible to add new features to a
clustered layer after the initial load.
I need a way to add features to a vector layer using a clustering
strategy that doesnt make all my previous clustered features vanish.
I would even understand it if it didnt visibly recalulate the clusters
untill i changed my zoom lvl,
but it definitly shouldnt make everything disaper when i add new
features.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20090401/5de1736d/attachment.html
More information about the Users
mailing list