[OpenLayers-Users] switching default layer before initial map display

stephane.poirier at usherbrooke.ca stephane.poirier at usherbrooke.ca
Mon Aug 31 11:11:04 EDT 2009


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.poirier at usherbrooke.ca 
Cc: users at 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.poirier at 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.Poirier at Usherbrooke.ca
  +1 (514) 509-8833 (actual work site telephone)


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


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20090831/20359c71/attachment.html


More information about the Users mailing list