Hallo zusammen,
ich lade über ein Array Daten zu Features in die Karte.
var clubs = new OpenLayers.Layer.Vector("Clubs", {
projection: "EPSG:4326",
strategies: [
new OpenLayers.Strategy.Fixed(),
new OpenLayers.Strategy.Cluster({distance: 10, threshold: 1})
],
protocol: new OpenLayers.Protocol.HTTP({
format: new OpenLayers.Format.Clubs()
}),
styleMap: new OpenLayers.StyleMap({
"default": pin_style
})
});
OpenLayers.Format.Clubs = OpenLayers.Class(OpenLayers.Format, {
read: function(obj) {
return mb.get_features(that.data);
},
data: mb.get_features(that.data),
keepData: true
});
Nun möchte ich die Ansicht am Anfang so zoomen, dass alle Pins gut zu sehen sind und die Karte auf dem Zentrum aller Pins zentrieren. Die Daten werden jeweils Regionsweise gefiltert. Also alle Clubs in Deutschland oder alle in Berlin.
Ich hatte es mit
var bounds = clubs.getDataExtent();
this.map.zoomToExtent(bounds);
versucht, aber laut Doku hat getDataExtent bei Vector erstmal keinerlei Funktionalität.
Weiß jemand wie ich das auf elegante Weise lösen kann?