When I'm making a map with a WMS layer, then the .setCenter works as expected. 
But when I replace the WMS layer with the OSM layer, than zooming with 
.setCenter works, but the map is always centered at 0,0.

Is it something I'm doing wrong?

The code I'm using is
         var map;

         function init(){
             map = new OpenLayers.Map('map', {
                       controls:[new OpenLayers.Control.Navigation(),
                                 new OpenLayers.Control.PanZoomBar(),
                                 new OpenLayers.Control.ScaleLine(),
                                 new OpenLayers.Control.MousePosition(),
                                 new OpenLayers.Control.Permalink(),
                                 new OpenLayers.Control.Attribution()
                       ],
                       maxExtent: new OpenLayers.Bounds(-180, -90, 180, 90),
                       displayProjection: new 
OpenLayers.Projection("EPSG:4326"),
                          maxResolution:'auto'
                    });
             layer = new OpenLayers.Layer.WMS( "OpenLayers WMS",
                 "http://labs.metacarta.com/wms/vmap0";, {layers: 'basic'} );
             map.addLayer(layer);

             map.setCenter(new OpenLayers.LonLat(5.3,52.15),6);

or change the last lines to:

             layer = new OpenLayers.Layer.OSM.Mapnik("Mapnik");
             map.addLayer(layer);

             map.setCenter(new OpenLayers.LonLat(5.3,52.15),6);

(or complete html at http://www.maasluip.nl/ebt/georss-markers-wms.html and 
http://www.maasluip.nl/ebt/georss-markers-osm.html)

Regards,
Maarten
_______________________________________________
Users mailing list
[email protected]
http://openlayers.org/mailman/listinfo/users

Reply via email to