Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

My openlayers code is as follows. But there is shift in between both the layers. How to rectify it?

map = new OpenLayers.Map( 'map_element',{} );           
        var gsat = new OpenLayers.Layer.Google(
            "Google Satellite",
            {type: G_HYBRID_MAP, 
             numZoomLevels: 22, 
             isBaseLayer: true, 
             'displayInLayerSwitcher':false},
              {sphericalMercator: true}
            );
        var roads = new OpenLayers.Layer.WMS(
        "Roads", "http://localhost:8088/geoserver/cite/wms",
        {layers: 'cite:viz_roads',
                     isBaseLayer: false,
                     transparent: true, 
                     opacity: 1.0} 
        );

        var org = new OpenLayers.Layer.WMS(
        "points of interest", "http://localhost:8088/geoserver/cite/wms",
        {layers: 'cite:organisations', 
                     isBaseLayer: false,
                     transparent: true, opacity: 1.0} 
        );
        map.addLayers([gsat,roads,org]);
        map.addControl(new OpenLayers.Control.LayerSwitcher({}));

if(!map.getCenter()){
map.setCenter(new OpenLayers.LonLat(83.324947,17.732909), 14);
}
    }

This is the snapshot of the map:

enter image description here

Observe the shift from position 1 to 2. 1 is the actual position where the feature should be. It is rectified automatically when I turn layer off and on. But how to rectify this error while zooming?

share|improve this question
1  
What is the projection of your map? I don't see you setting it in your code. And what is the projection of your WMS service? – Devdatta Tengshe Apr 30 '13 at 5:36
    
@DevdattaTengshe both are in 900913 projection. – Jeevan Patnaik May 1 '13 at 20:29

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.