Menu
Newbedev LogoNEWBEDEV Python Javascript Linux Cheat sheet
Newbedev LogoNEWBEDEV
  • Python 1
  • Javascript
  • Linux
  • Cheat sheet
  • Contact

Dynamically set zoom level based on a bounding box

You could simply use:

var group = new L.featureGroup([marker1, marker2, marker3]);

map.fitBounds(group.getBounds());

Using @Farhat's answer, I figured out that all I needed was to pass an array of arrays:

map.fitBounds([
  [-4.8587000, 39.8772333],
  [-6.4917667, 39.0945000]
])

Tags:

Leaflet

Related

What web mapping libraries are suitable for indoor maps? How to display NoData of a raster in QGIS Accessing the output of a Python script tool dialog ArcGIS 10.1 Moving a shapefile point to specific coordinates setStyle() function for GeoJSON features - Leaflet Renaming attributes/fields in shapefile attribute table using QGIS? Understanding terms in Length of Degree formula? Is there a python option to "join attributes by location"? Aerial Photograph Footprint Size Calculation ArcGIS modelbuilder: Iterate through Excel sheets? What does feature mean in QGIS? For looping folder to batch clip rasters by polygon using python and QGIS?

Recent Posts

Pandas how to find column contains a certain value Recommended way to install multiple Python versions on Ubuntu 20.04 Build super fast web scraper with Python x100 than BeautifulSoup How to convert a SQL query result to a Pandas DataFrame in Python How to write a Pandas DataFrame to a .csv file in Python
© 2021 newbedevPrivacy Policy