[OpenLayers-Users] Disappearing layers

eoinyp eoinyp at yahoo.com
Thu Aug 13 09:52:19 EDT 2009


Perfect! :)
Thank you Jerome.

--- On Thu, 13/8/09, Jerome Freyre (via Nabble) <ml-user+114850-1335474129 at n2.nabble.com> wrote:

From: Jerome Freyre (via Nabble) <ml-user+114850-1335474129 at n2.nabble.com>
Subject: Re: [OpenLayers-Users] Disappearing layers
To: "eoinyp" <eoinyp at yahoo.com>
Date: Thursday, 13 August, 2009, 12:40 PM



Hi Eoinyp,


I watched your code. I think you made a mistake with the zoom level on the function map.setCenter().


Try to modify the line like that:

map.setCenter(new OpenLayers.LonLat(17, 43), 12);


It should work ;)


Here is the copy of your code that I used and modify:

                map = new OpenLayers.Map("map");

                map.addControl(new OpenLayers.Control.LayerSwitcher());

        

                //create layer

                var  velayer = new OpenLayers.Layer.VirtualEarth(

                        "Roads Layer",

                        {

                                'type': VEMapStyle.Road 

                        } 

                );

        

                var velayer2 = new OpenLayers.Layer.VirtualEarth(

                        "Aerial Layer",

                        {

                                'type': VEMapStyle.Aerial

                        } 

                );


                map.addLayers([velayer, velayer2]);



                map.addControl(new OpenLayers.Control.PanZoomBar());

                map.addControl(new OpenLayers.Control.ScaleLine());

                map.addControl(new OpenLayers.Control.MousePosition());



                map.setCenter(new OpenLayers.LonLat(17, 43), 12);


Sincerly, 

Jérome




eoinyp wrote:
Im a newbie, having problem with my map layers. Which ever layer I add first is visible when the map loads, but when I try to switch layers they both disappear. I seem to be missing something fundamental, though I cant figure out what!! 

I am creating the layers and map as follows:


 init(){

create layer 1

create layer 2

add([layer1,layer2])

add[map controls]

}


The map can be seen at: http://www.eoinmaca.com/maps/OpenLayers/mymap.htm

Any help greatly appreciated,

Thanks,


Eoinyp








View message @ http://n2.nabble.com/Disappearing-layers-tp3436866p3437329.html


To unsubscribe from Disappearing layers, click here.







-- 
View this message in context: http://n2.nabble.com/Disappearing-layers-tp3436866p3438091.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20090813/2a132934/attachment.html


More information about the Users mailing list