- $("loading").innerHTML = "";
- this.map.zoomToExtent(this.features[0].geometry.getBounds());
- var center = getMapCenter();
- $("larger_map").href = '/?lat='+center.lat+'&lon='+center.lon+'&zoom='+this.map.getZoom();
- $("larger_map").innerHTML = "View Larger Map";
+ $("loading").innerHTML = "";
+ if (this.features.length) {
+ var extent = this.features[0].geometry.getBounds();
+ for (var i = 1; i < this.features.length; i++) {
+ extent.extend(this.features[i].geometry.getBounds());
+ }
+ if (extent) {
+ this.map.zoomToExtent(extent);
+ } else {
+ this.map.zoomToMaxExtent();
+ }
+ var center = getMapCenter();
+ $("larger_map").href = '/?lat='+center.lat+'&lon='+center.lon+'&zoom='+this.map.getZoom();
+ $("larger_map").innerHTML = "View Larger Map";
+ } else {
+ $("small_map").style.display = "none";
+ }