I am using OSM/Google maps and WMS Layers. Now I want to know how my WMS will overlay on this map. I am using the following code for that:
function init()
{
map = new OpenLayers.Map('map');
layer = new OpenLayers.Layer.OSM( "OpenStreet Map");
map.addLayer(layer);
layer = new OpenLayers.Layer.Google( "Google" );
map.addLayer(layer);
var jpl_wms = new OpenLayers.Layer.WMS("Administrative Layer",
"http://localhost:8080/geoserver/test/wms",
{layers: "maharashtra_administrative",transparent: true,visibility: false},{isBaseLayer:false});
map.addLayer(jpl_wms);
map.addControl(new OpenLayers.Control.LayerSwitcher());
map.setCenter(new OpenLayers.LonLat(8461018,2120810),6.75);
map.addControl(new OpenLayers.Control.MousePosition({}));
map.addControl(new OpenLayers.Control.OverviewMap());
map.addControl(new OpenLayers.Control.ScaleLine());
}
Can anybody guide me for the same as this overlay does not appear in the map.
Best Answer
The parameter
looks problematic to me. It's in the wrong place and will prevent your layer showing if it is in the right place.
Try something like:
Note I've assumed that you have placed your layer in the topp name space - you'd need to change that if you have created and used your own workspace.