I want to show a popup window where i am going to show a leaflet map. In the popup window i'll show the path between two points. These two points are two [lat,lon] pairs Point A is [lata,lona], Point B is [latb,lonb]. I want to set the view or or zoom level of the map so that the map is zoomed focusing the distance between point A and Point B. That means the map will have point A at near of one end of the map and point B at near of other end of the map. How can I do it. I am now using the following command to setview to to Point A and point A remains at middle. Here is my command
map.setView([A[0],A[1]],14);
So the point A is at the middle but the point B sometimes go even outside map. I want both A and B to be shown at map and the farthest distance within the map.