Hi!

My final hope lies in you as I have been struggling around since 2 days now
with OL. I try to use several baseLayers in my Map, that have different
projections(GoogleMaps/WMS). Additionally I want to overlay these baseLayers
with external data (e.g. WMS layer/Vetor).

To achieve a fitting WMS overlay with GoogleMaps I have to use
sphericalMercator projection (= EPSG:900913). Now I also want to have
baseLayers without spericalMercator (--> EPSG:4326) and easily switch
between these baseLayers. Therefor I listen for the
event(map.changebaselayer) and then call a function
"resetMapProjection(thenewlayer)".

The function already notifies me if the new baseLayer
(thenewlayer.sphericalMercator) is true or not, so I can distinguish if the
baseLayer I'm switching too needs to have (EPSG:4326) or (EPSG:900913)
settings.

                                function resetMapProjection(thenewlayer) {
                                        
if(map.getLayer(thenewlayer.sphericalMercator == true) {
                                                map.setOptions({
                                                        projection: 
"EPSG:900913",
                                                        displayProjection: 
"EPSG:4326",
                                                        units: "m",
                                                        maxResolution: 
156543.0339,
                                                        maxExtent: new 
OpenLayers.Bounds(-20037508, -20037508, 20037508,
20037508.34)
                                                });
                                        }
                                        else {
                                                map.setOptions({
                                                        projection: "EPSG:4326",
                                                        displayProjection: 
"EPSG:4326",
                                                        units: "dd",
                                                });
                                        }
                                        map.getLayer(thenewlayer).redraw();
                                }

Unfortunately the newly drawn map simply does not use the new map settings!
After the layer-switch I end up having a new map which has been set to
meters or degrees (or so on), but I can't make the new baseLayer to be
rendered using these new settings (Also "redraw()" does not work).
ggggggrrrrrr....I feel and the end of my wisdom :-(

And appreciate any hints!
Thank you!
-- 
View this message in context: 
http://www.nabble.com/Switch-of-Projection-%28sphericalMercator%29-tp15206156p15206156.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.

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

Reply via email to