CloudMade/Leaflet — Issue #418: How can I change the bounds of a WMS map?
Author: codecowboy
Created: 2012-01-05 16:27:26+00:00
State: open

I'm doing the following:

var bluemarble = new L.TileLayer.WMS("http://demo.opengeo.org/geoserver/wms", {
layers: 'bluemarble',
attribution: "Data © NASA Blue Marble, image service by OpenGeo",
minZoom: 2,
maxZoom: 3
});

GymloopChallenge.map.addLayer(bluemarble).fitWorld();

I am adding markers to the map and want the map to fit to those bounds so have tried:

GymloopChallenge.map.addLayer(bluemarble).fitBounds(new L.LatLngBounds(latlngs2));

instead of fitWorld() but this seems to have no effect

If I set minZoom to 1 the map is way too small on load and if I omit the fitWorld() call then the wms tiles do not appear at all.
Is it possible to fit to bounds in this way with wms tiles?