Thanks Francesco,

You got it! Only changing the order in which layer are added fixed it, the 
first added google layer being the default among the other google layers.

SP.




From: Francesco Pennica 
Sent: Monday, August 31, 2009 5:58 AM
To: stephane.poir...@usherbrooke.ca 
Cc: users@openlayers.org 
Subject: Re: [OpenLayers-Users] switching default layer before initial map 
display


Hello,

I think you just have to change the order when you add layers to map:

map.addLayers([googlestreetsLayer,googlephysicalLayer,...]);

to:

map.addLayers([googlephysicalLayer,googlestreetsLayer,...]);



2009/8/31 <stephane.poir...@usherbrooke.ca>

  Hi All,

  With the following code, I created a few google layers. Google streets gets 
to be the default. Now, how can I change the default layers to be, say, the 
google hybrid map?

  if

  (myepsg=="EPSG:900913")
  {
      googlestreetsLayer=new OpenLayers.Layer.Google("Google 
Streets",{"sphericalMercator": true,minZoomLevel: 2});
      googlephysicalLayer=new OpenLayers.Layer.Google("Google Physical",{type: 
G_PHYSICAL_MAP, "sphericalMercator": true,minZoomLevel: 2});
      googlesatelliteLayer=new OpenLayers.Layer.Google("Google 
Satellite",{type: G_SATELLITE_MAP, "sphericalMercator": true,minZoomLevel: 2});
      googlehybridLayer = new OpenLayers.Layer.Google("Google Hybrid",{type: 
G_HYBRID_MAP, "sphericalMercator": true,minZoomLevel: 2});
  }

  Stephane Poirier, M.Sc. Optic Physics 
  Remote Sensing Application Software Developer
  Université de Sherbrooke
  2500 Bd Université, Sherbrooke, Qc J1K 2R1 Canada
  www.usherbrooke.ca/cartel
  stephane.poir...@usherbrooke.ca
  +1 (514) 509-8833 (actual work site telephone)


  _______________________________________________
  Users mailing list
  Users@openlayers.org
  http://openlayers.org/mailman/listinfo/users


_______________________________________________
Users mailing list
Users@openlayers.org
http://openlayers.org/mailman/listinfo/users

Reply via email to