[OpenLayers-Dev] How to change projection to map and all layers?

Juan G juangon at gmail.com
Tue Mar 18 14:35:40 EDT 2008


Hi again!

I´ve been searching and trying to solve this big problem, but I didn´t
succeed unfortunately.

My problem is I have a requirement to make a drop down menu to change the
projection (SRS).

After searching for days, I found very little information about this, and I
don´t understand why, because in Spain there are some viewers working with
this funcionality, like this example:

http://www.idee.es/clientesIGN/wmsGenericClient/index.html?lang=EN

I´ve tried to change the projection in the current map object like this way:

map.setOptions({projection:...,maxExtent:...});

and I changed every layer projection iterating all layers in map like this:

for (i=0;i<map.layers.length;i++){
        var  layer=map.layers[i];
        layer.projection=new OpenLayers.Projection(...);
        layer.mergeNewParams({foo:"FOO"}); //DOING THIS TO REFRESH THE LAYER
WITH NEW DATA

}

After doing this, no image is showed. After some investigation, I saw that
in the URL of every tile image of every layer (GetMap service)  the "SRS"
param was ok, but the BBOX param wasn´t refreshed with the new BBOX
(maxExtent). Another thing I found is that the  mouse position wasn´t
updated with the new projection.

Please, could you tell me some efficient way and compatible with future
versions of OpenLayers for changing the map projection (I mean map and every
overlay of course).

Thanks you very much!


Juan G
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-dev/attachments/20080318/d4dad1f2/attachment.html


More information about the Dev mailing list