<table cellspacing="0" cellpadding="0" border="0"><tr><td valign="top" style="font: inherit;">Perfect! :)<br>Thank you Jerome.<br><br>--- On <b>Thu, 13/8/09, Jerome Freyre (via Nabble) <i>&lt;<a href="http://n2.nabble.com/user/SendEmail.jtp?type=node&node=3438091&i=0" target="_top" rel="nofollow">[hidden email]</a>&gt;</i></b> wrote:<br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"><br>From: Jerome Freyre (via Nabble) &lt;<a href="http://n2.nabble.com/user/SendEmail.jtp?type=node&node=3438091&i=1" target="_top" rel="nofollow">[hidden email]</a>&gt;<br>Subject: Re: [OpenLayers-Users] Disappearing layers<br>To: "eoinyp" &lt;<a href="http://n2.nabble.com/user/SendEmail.jtp?type=node&node=3438091&i=2" target="_top" rel="nofollow">[hidden email]</a>&gt;<br>Date: Thursday, 13 August, 2009, 12:40 PM<br><br><div id="yiv179255503">

Hi Eoinyp,
<br><br>I watched your code. I think you made a mistake with the zoom level on the function map.setCenter().
<br><br>Try to modify the line like that:
<br>map.setCenter(new OpenLayers.LonLat(17, 43), 12);
<br><br>It should work ;)
<br><br>Here is the copy of your code that I used and modify:
<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; map = new OpenLayers.Map("map");
<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; map.addControl(new OpenLayers.Control.LayerSwitcher());
<br>&nbsp; &nbsp; &nbsp; &nbsp; 
<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //create layer
<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var &nbsp;velayer = new OpenLayers.Layer.VirtualEarth(
<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "Roads Layer",
<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {
<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'type': VEMapStyle.Road 
<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } 
<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; );
<br>&nbsp; &nbsp; &nbsp; &nbsp; 
<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var velayer2 = new OpenLayers.Layer.VirtualEarth(
<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "Aerial Layer",
<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {
<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'type': VEMapStyle.Aerial
<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } 
<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; );
<br><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; map.addLayers([velayer, velayer2]);
<br><br><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; map.addControl(new OpenLayers.Control.PanZoomBar());
<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; map.addControl(new OpenLayers.Control.ScaleLine());
<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; map.addControl(new OpenLayers.Control.MousePosition());
<br><br><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; map.setCenter(new OpenLayers.LonLat(17, 43), 12);
<br><br>Sincerly, 
<br>Jérome
<br><br><br><blockquote class="quote light-black dark-border-color"><div class="quote light-border-color">
<div class="quote-author" style="font-weight: bold;">eoinyp wrote:</div>
<div class="quote-message shrinkable-quote">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!! 
<br>I am creating the layers and map as follows:
<br><br>&nbsp;init(){
<br>create layer 1
<br>create layer 2
<br>add([layer1,layer2])
<br>add[map controls]
<br>}
<br><br>The map can be seen at: <a rel="nofollow" target="_blank" href="http://www.eoinmaca.com/maps/OpenLayers/mymap.htm">http://www.eoinmaca.com/maps/OpenLayers/mymap.htm</a><br><br>Any help greatly appreciated,
<br>Thanks,
<br><br>Eoinyp
</div>
</div></blockquote>

<br><br>
<hr size="1" color="#cccccc" noshade="noshade">
<div style="color: rgb(102, 102, 102); font-family: tahoma,geneva,helvetica,arial,sans-serif; font-style: normal; font-variant: normal; font-weight: normal; font-size: 11px; line-height: normal; font-size-adjust: none; font-stretch: normal; -x-system-font: none;">
View message @ <a rel="nofollow" target="_blank" href="http://n2.nabble.com/Disappearing-layers-tp3436866p3437329.html">http://n2.nabble.com/Disappearing-layers-tp3436866p3437329.html</a>

<br>To unsubscribe from Disappearing layers, <a rel="nofollow" target="_blank">click here</a>.
</div>
<br>
</div></blockquote></td></tr></table><br>




<br><hr align="left" width="300">
View this message in context: <a href="http://n2.nabble.com/Disappearing-layers-tp3436866p3438091.html">Re: [OpenLayers-Users] Disappearing layers</a><br>
Sent from the <a href="http://n2.nabble.com/OpenLayers-Users-f1822463.html">OpenLayers Users mailing list archive</a> at Nabble.com.<br>