for items which don't actually have a geometry, just zoomToMaxExtent.
[rails.git] / app / views / browse / _map.rhtml
index 466c9b6cc488729605bcb4fb7ff09047def892ad..a0fcc06aae471aab057a6c73e89451058e23b275 100644 (file)
         for (var i = 1; i < this.features.length; i++) {
             extent.extend(this.features[i].geometry.getBounds());
         }
-        this.map.zoomToExtent(extent);
-        var center = getMapCenter();
+        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 {