[OpenLayers-Users] Wipe out Map for different projection
Andreas Hocevar
ahocevar at opengeo.org
Thu Oct 8 09:27:58 EDT 2009
Hi,
why don't you just configure your WMS base layer in both projections
(instead of configuring the map with a projection)? When you switch the
base layer, the map will automatically change its projection. Just make
sure that you remove the google layers before you switch to EPSG:4326.
Regards,
Andreas.
Heiko Schröter wrote:
> Hello,
>
> i'am fairly new to OpenLayer so i don't know if this has been asked before.
>
> I want to display a map in two projections which can be selected on the webpage.
> EPSG4326 and EPSG900913.
>
> But i cannot "wipe" out the old projection and reload init(projektion) with the new projection.
> I've tried to do remove the layers etc. But that doesn't work.
>
> It reloads the new projection but below and outside the <div>map</div>.
> It looks like it is attached to the old (cleaned) <div>map</div>.
>
> Is there a way to completely "RESET" the OpenLayer.Map setup or is it better to reload the page to completely wipe out the DOM ?
>
> Thanks and Regards
> Heiko
>
>
>
> <snip>
> function init(projektion) {
> registerDataRequester(); // Event Registers i.e. 'layer.events.register'
>
> var options = {
> projection: new OpenLayers.Projection(projektion),
> displayProjection: new OpenLayers.Projection("EPSG:4326"),
> units: "m",
> maxResolution: 156543.0339,
> maxExtent: new OpenLayers.Bounds(xxmin,yymin,xxmax,yymax),
> restrcitedExtent: new OpenLayers.Bounds(xxmin,yymin,xxmax,yymax),
> controls: [ //new OpenLayers.Control.PanZoom(),
> new OpenLayers.Control.Navigation(),
> new OpenLayers.Control.MousePosition({"numDigits": 2}),
> new OpenLayers.Control.LayerSwitcher()
> ],
> numZoomLevels: 8
> };
>
> map = new OpenLayers.Map('map', options);
>
> click = new OpenLayers.Control.Click({handlerOptions: {"single": true}});
> map.addControl(click);
>
> var baselayer = new OpenLayers.Layer.WMS( "IUP WMS",
> http_mapserver,
> {map: mapfile,
> layers: "KARTE,GRID,LOGO,COPYRIGHT",
> transparent: false},
> {singleTile:true, isBaseLayer: true,
> wrapDateLine: true,
> //reproject: true,
> queryable: true});
> // "some more Google Layers ... pushing make_base_layers" if EPSG900913
>
> make_base_layers.push(baselayer);
>
> loadInfoPopUp(baselayer); //
> map.addLayers(make_base_layers);
>
> map.setCenter(new OpenLayers.LonLat(0, 0), 3);
> <snap>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>
--
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.
More information about the Users
mailing list