Zooming to the maximum extent of all features in a vector layer does not work unless all features have been loaded. Therefore it is necessary to register an event handler, as demonstrated below ('layer' is any object of class OpenLayers.Layer.Vector):
layer.events.register('featuresadded', map,function(){this.zoomToExtent(layer.getDataExtent())});
No comments:
Post a Comment