Advertisement
Guest User

Untitled

a guest
Jun 12th, 2013
266
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. this.map = new OpenLayers.Map({ div: "map", projection: "EPSG:3857" });
  2.  
  3. ...
  4.  
  5. var base_layers = [];
  6.         if(this.model.get("base_layer_type") !== BASE_LAYERS.ALL_COMMERCIAL) {
  7.             switch(this.model.get("base_layer_type")) {
  8.                 case BASE_LAYERS.GOOGLE_TERRAIN:
  9.                     base_layers.push(new OpenLayers.Layer.Google("Google Terrain", {type: google.maps.MapTypeId.TERRAIN, numZoomLevels:28}));
  10.                     break;
  11.                 case BASE_LAYERS.GOOGLE_PHYSICAL:
  12.                     base_layers.push(new OpenLayers.Layer.Google("Google Satellite", {type: google.maps.MapTypeId.SATELLITE, numZoomLevels:28}));
  13.                     break;
  14.                 case BASE_LAYERS.GOOGLE_ROADS:
  15.                     base_layers.push(new OpenLayers.Layer.Google("Google Streets", {type: google.maps.MapTypeId.ROADS, numZoomLevels:28}));
  16.                     break;
  17.                 case BASE_LAYERS.GOOGLE_HYBRID:
  18.                     base_layers.push(new OpenLayers.Layer.Google("Google Hybrid", {type: google.maps.MapTypeId.HYBRID, numZoomLevels:28}));
  19.                     break;
  20.                 case BASE_LAYERS.BING_ROADS:
  21.                     if(this.bing_api_key) base_layers.push(new OpenLayers.Layer.Bing({ name: "Bing Roads", type: "Road"}));
  22.                     break;
  23.                 case BASE_LAYERS.BING_AERIAL:
  24.                     if(this.bing_api_key) base_layers.push(new OpenLayers.Layer.Bing({ name: "Bing Hybrid", type: "AerialWithLabels"}));
  25.                     break;
  26.                 case BASE_LAYERS.OPEN_STREETMAP:
  27.                     base_layers.push(new OpenLayers.Layer.Google("Google Hybrid", {type: google.maps.MapTypeId.HYBRID, numZoomLevels:22}));
  28.                     base_layers.push(new OpenLayers.Layer.Google("Google Satellite", {type: google.maps.MapTypeId.SATELLITE, numZoomLevels:22}));
  29.                     base_layers.push(new OpenLayers.Layer.XYZ(
  30.                             "OpenStreetMap",
  31.                             [
  32.                                 "http://otile1.mqcdn.com/tiles/1.0.0/osm/${z}/${x}/${y}.png",
  33.                                 "http://otile2.mqcdn.com/tiles/1.0.0/osm/${z}/${x}/${y}.png",
  34.                                 "http://otile3.mqcdn.com/tiles/1.0.0/osm/${z}/${x}/${y}.png",
  35.                                 "http://otile4.mqcdn.com/tiles/1.0.0/osm/${z}/${x}/${y}.png"
  36.                             ],
  37.                             {
  38.                                 attribution: "Data, imagery and map information provided by <a href='http://www.mapquest.com/'  target='_blank'>MapQuest</a>, <a href='http://www.openstreetmap.org/' target='_blank'>Open Street Map</a> and contributors, <a href='http://creativecommons.org/licenses/by-sa/2.0/' target='_blank'>CC-BY-SA</a>  <img src='http://developer.mapquest.com/content/osm/mq_logo.png' border='0'>",
  39.                                 transitionEffect: "resize",
  40.                                 numZoomLevels:28
  41.                             }
  42.                     ));
  43.                     break;
  44.                 case BASE_LAYERS.WMS:
  45.                     base_layers.push(new OpenLayers.Layer.WMS(this.model.get('name'), eval(this.model.get('base_layer_creation_options'))));
  46.                     break;
  47.                 case BASE_LAYERS.WMTS:
  48.                     base_layers.push(new OpenLayers.Layer.WMTS(this.model.get('name'), eval(this.model.get('base_layer_creation_options'))));
  49.                     break;
  50.                 default:
  51.                     throw "no such layer type";
  52.                     break;
  53.             }
  54.         }
  55.  
  56. ...
  57.  
  58. this.map.addLayers(base_layers);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement