X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/e414d10aa10815b07e0ab334db4d96c4b3ac9b6b..d69a518b9e69107503b332728dfa583594293ea1:/app/views/browse/_map.rhtml diff --git a/app/views/browse/_map.rhtml b/app/views/browse/_map.rhtml index 466c9b6cc..a0fcc06aa 100644 --- a/app/views/browse/_map.rhtml +++ b/app/views/browse/_map.rhtml @@ -21,8 +21,12 @@ 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 {