- // Create layer and overlays variables
- var leaflet_layers = {}
- var leaflet_overlays = {}
+ // Set initial view if URL parameters are available, otherwise fitBounds
+ if (lat !== null && lon !== null && zoom !== null) {
+ map.setView([lat, lon], zoom);
+ } else {
+ map.fitBounds(<%= @bbox.to_json %>);
+ }
+
+ // Create a layer switcher
+ var layers = L.control.layers(null, null, {collapsed:false}).addTo(map);