Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- this.map = new OpenLayers.Map({ div: "map", projection: "EPSG:3857" });
- ...
- var base_layers = [];
- if(this.model.get("base_layer_type") !== BASE_LAYERS.ALL_COMMERCIAL) {
- switch(this.model.get("base_layer_type")) {
- case BASE_LAYERS.GOOGLE_TERRAIN:
- base_layers.push(new OpenLayers.Layer.Google("Google Terrain", {type: google.maps.MapTypeId.TERRAIN, numZoomLevels:28}));
- break;
- case BASE_LAYERS.GOOGLE_PHYSICAL:
- base_layers.push(new OpenLayers.Layer.Google("Google Satellite", {type: google.maps.MapTypeId.SATELLITE, numZoomLevels:28}));
- break;
- case BASE_LAYERS.GOOGLE_ROADS:
- base_layers.push(new OpenLayers.Layer.Google("Google Streets", {type: google.maps.MapTypeId.ROADS, numZoomLevels:28}));
- break;
- case BASE_LAYERS.GOOGLE_HYBRID:
- base_layers.push(new OpenLayers.Layer.Google("Google Hybrid", {type: google.maps.MapTypeId.HYBRID, numZoomLevels:28}));
- break;
- case BASE_LAYERS.BING_ROADS:
- if(this.bing_api_key) base_layers.push(new OpenLayers.Layer.Bing({ name: "Bing Roads", type: "Road"}));
- break;
- case BASE_LAYERS.BING_AERIAL:
- if(this.bing_api_key) base_layers.push(new OpenLayers.Layer.Bing({ name: "Bing Hybrid", type: "AerialWithLabels"}));
- break;
- case BASE_LAYERS.OPEN_STREETMAP:
- base_layers.push(new OpenLayers.Layer.Google("Google Hybrid", {type: google.maps.MapTypeId.HYBRID, numZoomLevels:22}));
- base_layers.push(new OpenLayers.Layer.Google("Google Satellite", {type: google.maps.MapTypeId.SATELLITE, numZoomLevels:22}));
- base_layers.push(new OpenLayers.Layer.XYZ(
- "OpenStreetMap",
- [
- "http://otile1.mqcdn.com/tiles/1.0.0/osm/${z}/${x}/${y}.png",
- "http://otile2.mqcdn.com/tiles/1.0.0/osm/${z}/${x}/${y}.png",
- "http://otile3.mqcdn.com/tiles/1.0.0/osm/${z}/${x}/${y}.png",
- "http://otile4.mqcdn.com/tiles/1.0.0/osm/${z}/${x}/${y}.png"
- ],
- {
- 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'>",
- transitionEffect: "resize",
- numZoomLevels:28
- }
- ));
- break;
- case BASE_LAYERS.WMS:
- base_layers.push(new OpenLayers.Layer.WMS(this.model.get('name'), eval(this.model.get('base_layer_creation_options'))));
- break;
- case BASE_LAYERS.WMTS:
- base_layers.push(new OpenLayers.Layer.WMTS(this.model.get('name'), eval(this.model.get('base_layer_creation_options'))));
- break;
- default:
- throw "no such layer type";
- break;
- }
- }
- ...
- this.map.addLayers(base_layers);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement