How to zoom a leaflet map depending on the latitude and longitude -
i want show popup window going show leaflet map. in popup window i'll show path between 2 points. these 2 points 2 [lat,lon] pairs point [lata,lona], point b [latb,lonb]. want set view or or zoom level of map map zoomed focusing distance between point , point b. means map have point @ near of 1 end of map , point b @ near of other end of map. how can it. using following command setview to point , point remains @ middle. here command
map.setview([a[0],a[1]],14);
so point @ middle point b go outside map. want both , b shown @ map , farthest distance within map.
use fitbounds method instead of setview
if want focus map area rather point.
Comments
Post a Comment