I am new to JavaScript/OpenLayers. I would like to add a WMS layer (BLD_504) from dwasa (workspace) locally. The code is as follows:
<!DOCTYPE HTML>
<html>
<head>
<title> Dhaka WASA </title>
<script src="http://www.openlayers.org/api/OpenLayers.js"></script>
<script src="http://openweathermap.org/js/OWM.OpenLayers.1.3.4.js">
</script>
<script>
function init() {
// Add osm background layer
map = new OpenLayers.Map("mapdiv");
var mapnik = new OpenLayers.Layer.OSM();
map.addLayer(mapnik);
// Add wms layer locally
var dma_504 = new OpenLayers.Layer.WMS( "Buildings 504","http://localhost:8080/geoserver/dwasa",
{layers: 'dwasa:BLD_504', transparent:true}, {isBaseLayer:false} );
map.addLayer(dma_504);
// Set the centre of the map
var lonlat = new OpenLayers.LonLat(90.4, 23.78).transform(
new OpenLayers.Projection("EPSG:4326"), // transform from WGS 1984
new OpenLayers.Projection("EPSG:900913") // to Spherical Mercator
);
var zoom = 14;
map.setCenter(lonlat, zoom);
map.addControl(new OpenLayers.Control.LayerSwitcher());
}
</script>
<style>
#mapdiv { width:1000px; height:700px; }
div.olControlAttribution { bottom:3px; }
</style>
</head>
<body onload="init();">
<div id="mapdiv"></div>
</body>
</html>
When I zoom in I see the following:

The data looks good in GeoServer:

Note that the “srs” param will always be ignored. Instead, it will be derived from the baseLayer’s or map’s projection.
My 'layer' is in 4326. I'll save it as 3857 in geoserver.
– Jonne Kleijer Oct 15 '14 at 10:41