map - leafletjs setMaxBounds wont let zoom out to see whole world -


i using leaflet js show world map using cloudmade tiles. when setmaxbounds map bounds work great except north. is, however, not biggest concern. concern is, use maxbounds can not zoom out see whole world in screen size.

the bound used reaches way north east corner of canada south west of australia. can pan reach bounds cant zoom out see whole map. set minzoom 0. without maxbound, zoomed out far can see world repeat thrice on big screen.

map = l.map('canvas',{zoomcontrol: false}).setview([38.82259, -2.8125], 0); map.setmaxbounds([[84.67351256610522, -174.0234375], [-58.995311187950925, 223.2421875]]); 

any appriciated. anil

if understand correctly, problem want able see entire world in view, want able restrict user seeing tiles wrapped around.

first, leaflet doing telling do. check out jsfiddle created code. http://jsfiddle.net/zf6bf/ can zoom out see entire world, if resize result pane large enough show entire world, without violating maxbounds rule. appears correct behavior me.

second, if not want world wrap, can set nowrap option true when creating layer.

var osmlayer = new l.tilelayer("http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", { nowrap: true}).addto(map); 

this prevent layer wrapping around map. if wrapping made create bounds in first place, perhaps removing wrapping remove need set maxbounds. map able panned , zoomed freely.


Comments

Popular posts from this blog

Change php variable from jquery value using ajax (same page) -

Pull out data related to my apps from Android Play Store and iOS App Store -

How can I fetch data from a web server in an android application? -