Hello all,<div><br></div><div>For some reason i'm not able to send an email to the openlayers list (i always get a mail back with error 551) and so i decided to sent to you guys.</div><div>Some time ago Matt has highlighted how to achieve reprojection of the openlayers map upon base layer change and this is working correctly. However after reprojecting i can't pan and if i make a zoom it will go to a strange location (i think the zoom is still assuming the old coordinates). After making the zoom i'm able to pan and zoom normally. </div>
<div><br></div><div>The code i'm using:</div><div><br></div><div>function onBaseLayerChange(evtObj){</div><div> var mapProj, baseProj, map, newBase, reproject;</div><div> map = this;</div><div> newBase = evtObj.layer;</div>
<div> mapProj = (map.projection && map.projection instanceof OpenLayers.Projection) ? map.projection : new OpenLayers.Projection(map.projection);</div><div> baseProj = newBase.projection;</div><div> reproject = !(baseProj.equals(mapProj));</div>
<div> if (reproject) {</div><div> var center, maxExt;</div><div> center = map.getCenter().transform(mapProj, baseProj);</div><div> maxExt = newBase.maxExtent;</div><div> map.projection = baseProj;</div>
<div> map.resolutions = newBase.resolutions;</div><div> map.maxResolution = newBase.maxResolution;</div><div> map.minResolution = newBase.minResolution;</div><div> map.maxExtent = maxExt;</div><div> map.restrictedExtent = newBase.restrictedExtent;</div>
<div> map.setCenter(center);</div><div> }</div><div>}</div><div><br></div><div>I suppose i'm not setting some property... but which one?</div><div><br></div><div>Thanks in advance.</div><div>Cheers,</div><div>Hugo</div>
<div><br clear="all"><br>-- <br>Hugo Martins<br>LabNT - ISEGI UNL<br>Campus de Campolide<br>1070-312 Lisboa<br>N 38°43'56.84", W 9°9'35.74"<br>
</div>