javascript - Centering Leaflet map with getbounds and related issues -


i ran leaflet issue can't solve it. may there's easy solution don't know.

so centering map of grouped markers isn't difficult , can done following:

var markerlayer = l.featuregroup(marker)         .addto(map);  var bounds = markerlayer.getbounds(); map.fitbounds(bounds); 

where marker array of markers. problem marker array information send code generated system. marker can far apart in map or can close.

when markers far apart code above works , centers map. if markers close (for example if same street), or better yet if there 1 marker problems arise. because getbounds give me rectangle small leaflet breaks (and of no use user well). mean map tries zoom in marker. question how limit zoom. example if there marker in map want map show marker , few streets around it.

you can give maxzoom map , fitbounds not override it.


Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -