0
votes

I am trying to overlay WMS on OSM base map but not getting displayed WMS at zoom, but at zoomToMaxExtent(); it is displayed. Now i want to display the WMS at zoom of OSM. My WMS EPSG:4326. Following is the code:

    var layer = new OpenLayers.Layer.OSM("OpenStreet Map");
     map.addLayer(layer);

     var mah2 = new OpenLayers.Layer.WMS("Nature Layer",
                    "http://localhost:8080/geoserver/trypoles/wms", 
                    {layers: "maharashtra_natural",transparent: true},               {isBaseLayer:false});
     map.addLayer(mah2);
//for zooming
   map.setCenter(new OpenLayers.LonLat(8461018,2120810),6.75);

Let me know what is the issue?

1

1 Answers

0
votes

You need to transform the projection from EPSG:4326(WGS84) to EPSG:900913(spherical mercator). Here is the code that can help you http://wiki.openstreetmap.org/wiki/OpenLayers_Simple_Example