Hi Everyone,

I sent the following message before Christmas via Nabble, however I am
unable to track down the reply I received. Can anyone help with my
problem?

Regards,

Rob Connolly

--Original Message--

Hi, 

I'm having trouble using the setCenter method when using a EPSG:900913
projection for a Google map layer, see my code below: 

map = new OpenLayers.Map('map', {projection: new
OpenLayers.Projection("EPSG:900913")}); 
var gmap = new OpenLayers.Layer.Google("Google Streets",
{ sphericalMercator: true }); // streets is the default 

map.addLayers([gmap]); 


var center = new OpenLayers.LonLat(-41.27, 173.28); 
alert('['+center.lon+','+center.lat+']'); 
var proj = new OpenLayers.Projection("EPSG:4326"); 
center.transform(proj, map.getProjectionObject()); 
alert('['+center.lon+','+center.lat+']'); 
map.setCenter(center, 13); 

I have the proj4js library installed and included on the page. It
appears that the conversion is working (from the data being shown by my
alert statements), however the center of the map remains on the
equator/prime meridian intersection, when it should be over Nelson, New
Zealand! 

Can anyone help? 

Regards, 

Rob Connolly

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

Reply via email to