- var attribution = 'Data by <a target="_parent" href="http://www.openstreetmap.org">OpenStreetMap</a>';
- var args = OpenLayers.Util.getParameters();
- if (!args.layer || args.layer == "mapnik") {
- var mapnik = new OpenLayers.Layer.OSM.Mapnik("Mapnik", {
- displayOutsideMaxExtent: true,
- wrapDateLine: true,
- attribution: attribution
- });
- map.addLayer(mapnik);
- } else {
- var osmarender = new OpenLayers.Layer.OSM.Osmarender("Osmarender", {
- displayOutsideMaxExtent: true,
- wrapDateLine: true,
- attribution: attribution
- });
- map.addLayer(osmarender);
- }
- if (args.marker) {
- var markers = new OpenLayers.Layer.Markers();
- map.addLayer(markers);
- var center = args.marker.split(",");
- markers.addMarker( new OpenLayers.Marker(new OpenLayers.LonLat(center[1], center[0]).transform(map.displayProjection, map.getProjectionObject())));
- map.marker = true;
- }
- if (args.bbox) {
- var bounds = OpenLayers.Bounds.fromString(args.bbox).transform(map.displayProjection, map.getProjectionObject());
- var center = bounds.getCenterLonLat();
- map.setCenter(center, map.getZoomForExtent(bounds, true);
- } else {
- map.zoomToMaxExtent();
- }
- var size = map.getSize();
- if (size.h > 320) {
- map.addControl(new OpenLayers.Control.PanZoomBar());
- } else {
- map.addControl(new OpenLayers.Control.PanZoom());
- }
- }
+ if (args.bbox) {
+ map.fitBounds([L.latLng(args.bbox[1], args.bbox[0]),
+ L.latLng(args.bbox[3], args.bbox[2])])
+ } else {
+ map.fitWorld();
+ }