CloudMade/Leaflet — Issue #385: map.getBounds with zoom level < 3
Author: zedd45
Created: 2011-12-02 16:03:18+00:00
State: open

I have been using Leaflet for several weeks to create an interactive map with several base layers and overlays. one of my overlays contains several circle markers (grouped by a custom MarkerClusterer I've written and hope to re-contribute when it's finished). The problem is that when I zoom in, I need to redraw the clusters. This works great at lower zoom levels ( this._map.getZoom() > 2), but at higher zoom levels (1 & 2) the bounds object returned does not always cover the entire view port.

I think it's important to mention that I have the map fullscreen in Firefox on my 27" Apple Thunderbolt display. I realize not everyone will be viewing maps on such a large device, but this is becoming a more and more realistic screen size every month.

I have been drawing a polygon / polyline to outline what map.getBounds() returns, and at higher (>2) zoom levels, it gets the entire map viewport. but when I get back to 1 or 2, it doesn't work properly.

I think the issue is caused by the fact that when the map is zoomed out all the way, the maps is repeating several times across the screen, and it's unable to get the "real" bounds.