Project

General

Profile

Download (8.62 KB) Statistics
| Branch: | Tag: | Revision:
1
/*
2
 * Layer definitions for CdmOpenLayers (openlayers_map.js)
3
 */
4

    
5
(function() {
6

    
7
    window.CdmOpenLayers.getLayerByName = function(layerName){
8

    
9
        switch(layerName){
10

    
11
          case 'metacarta_vmap0':
12
            /**
13
             * NOTE: labs.metacarta.com is currently unavailable
14
             *
15
             * Available Projections:
16
             *     EPSG:900913
17
             *     EPSG:4326
18
             */
19
            return  new OpenLayers.Layer.WMS(
20
                  "Metacarta Vmap0",
21
                  "http://labs.metacarta.com/wms/vmap0",
22
                  {layers: "basic", format:"png"},
23
                  {
24
                      maxExtent: window.CdmOpenLayers.mapExtends.epsg_4326,
25
                      projection: window.CdmOpenLayers.projections.epsg_4326,
26
                      isBaseLayer: true,
27
                      displayInLayerSwitcher: true
28
                  }
29
            );
30

    
31
          case 'osgeo_vmap0':
32
            /**
33
             * Available Projections:
34
             *    EPSG:4269
35
                  EPSG:4326
36
                  EPSG:900913
37
             */
38
            return  new OpenLayers.Layer.WMS(
39
                  "OSGEO Vmap0",
40
                  "http://vmap0.tiles.osgeo.org/wms/vmap0",
41
                  {layers: 'basic', format:"png"},
42
                  {
43
                    maxExtent: window.CdmOpenLayers.mapExtends.epsg_4326,
44
                    projection: new OpenLayers.Projection("EPSG:4326"),
45
                    isBaseLayer: true,
46
                    displayInLayerSwitcher: true
47
                  }
48
                );
49

    
50
         /**
51
          * TODO unused, can be deleted?
52
          */
53
         case 'edit-etopo1':
54
            return  new OpenLayers.Layer.WMS(
55
                  "ETOPO1 Global Relief Model",
56
                  "http://edit.br.fgov.be:8080/geoserver/wms",
57
                  {layers: 'topp:color_etopo1_ice_full', format:"image/png"},
58
                  {
59
                    maxExtent: window.CdmOpenLayers.mapExtends.epsg_4326,
60
                    projection: new OpenLayers.Projection("EPSG:4326"),
61
                    isBaseLayer: true,
62
                    displayInLayerSwitcher: true
63
                  }
64
                );
65

    
66
        /**
67
         * TODO unused, can be deleted?
68
         */
69
        case 'edit-vmap0_world_basic':
70
            return  new OpenLayers.Layer.WMS(
71
                  "EDIT Vmap0",
72
                  "http://edit.br.fgov.be:8080/geoserver/wms",
73
                  {layers: 'vmap0_world_basic', format:"image/png"},
74
                  {
75
                    maxExtent: window.CdmOpenLayers.mapExtends.epsg_900913,
76
                    isBaseLayer: true,
77
                    displayInLayerSwitcher: true
78
                  }
79
            );
80

    
81
          /*
82
           * OSM Layers:
83
           *
84
           *   minZoomLevel is not supported for XYZ layers, of which OSM is a subclass.
85
           *   http://trac.osgeo.org/openlayers/ticket/2909
86
           *   http://trac.osgeo.org/openlayers/ticket/2189
87
           *   solution in OL 2.12
88
           *
89
           *   see also http://stackoverflow.com/questions/4240610/min-max-zoom-level-in-openlayers
90
           *   and http://trac.osgeo.org/openlayers/wiki/SettingZoomLevels
91
           *
92
           *   To allow OSM baselayers to zoom out to the full extend of the world the map width must be
93
           *   multiple of 256px since the osm tiles from tile.openstreetmap.org have a size of 256px x 256px
94
           *   and fractional tiles are not supported by XYZ layers like OSM
95
           */
96
          case 'mapnik':
97
              return  new OpenLayers.Layer.OSM();
98

    
99
          case 'mapquest_open':
100
              // see http://developer.mapquest.com/web/products/open/map
101
              return new OpenLayers.Layer.XYZ(
102
                      "MapQuest",
103
                      [
104
                          "http://otile1.mqcdn.com/tiles/1.0.0/map/${z}/${x}/${y}.png",
105
                          "http://otile2.mqcdn.com/tiles/1.0.0/map/${z}/${x}/${y}.png",
106
                          "http://otile3.mqcdn.com/tiles/1.0.0/map/${z}/${x}/${y}.png",
107
                          "http://otile4.mqcdn.com/tiles/1.0.0/map/${z}/${x}/${y}.png"
108
                      ],
109
                      {
110
                          // If using the MapQuest-OSM tiles, OpenStreetMap must be given credit for the data
111
                          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'>",
112
                          transitionEffect: "resize"
113
                      }
114
                  );
115

    
116
          case 'mapquest_sat':
117
              // see http://developer.mapquest.com/web/products/open/map
118
              return new OpenLayers.Layer.XYZ(
119
                      "MapQuest Sattelite",
120
                      [
121
                          "http://otile1.mqcdn.com/tiles/1.0.0/sat/${z}/${x}/${y}.png",
122
                          "http://otile2.mqcdn.com/tiles/1.0.0/sat/${z}/${x}/${y}.png",
123
                          "http://otile3.mqcdn.com/tiles/1.0.0/sat/${z}/${x}/${y}.png",
124
                          "http://otile4.mqcdn.com/tiles/1.0.0/sat/${z}/${x}/${y}.png"
125
                      ],
126
                      {
127
                          // If using the MapQuest-OSM tiles, OpenStreetMap must be given credit for the data
128
                          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'>",
129
                          transitionEffect: "resize"
130
                      }
131
                  );
132

    
133
          // create Google Mercator layers
134
          case 'gmap':
135
            return  new OpenLayers.Layer.Google(
136
                      "Google Streets",
137
                      {
138
                          // the default type
139
                          projection: window.CdmOpenLayers.projections.epsg_900913,
140
                          // Allow user to pan forever east/west
141
                          // Setting this to false only restricts panning if sphericalMercator is true.
142
                          wrapDateLine: false,
143
                          sphericalMercator: true,
144
                          numZoomLevels: 21,
145
                      }
146
                  );
147

    
148
          case 'gsat':
149
              // FIMXE: layer distorted, use OpenLayers.Layer.Google.v3?
150
            return  new OpenLayers.Layer.Google(
151
                      "Google Satellite",
152
                      {
153
                        type: G_SATELLITE_MAP,
154
                        projection: window.CdmOpenLayers.projections.epsg_900913,
155
                        // Allow user to pan forever east/west
156
                        // Setting this to false only restricts panning if sphericalMercator is true.
157
                        wrapDateLine: false,
158
                        numZoomLevels: 22
159
                      }
160
                  );
161
          case 'ghyb':
162
              // FIMXE: layer not working, use OpenLayers.Layer.Google.v3?
163
            return  new OpenLayers.Layer.Google(
164
                      "Google Hybrid",
165
                      {
166
                          type: G_HYBRID_MAP,
167
                          projection: window.CdmOpenLayers.projections.epsg_900913,
168
                          // Allow user to pan forever east/west
169
                          // Setting this to false only restricts panning if sphericalMercator is true.
170
                          wrapDateLine: false,
171
                          numZoomLevels: 22
172
                      }
173
                  );
174
          /*
175
           * FIXME: apiKey needs to be specified
176
          case 'veroad':
177
          case 'bing_road':
178
              return  new OpenLayers.Layer.Bing({
179
                  name: "Road",
180
                  key: apiKey,
181
                  type: "Road"
182
              });
183

    
184
          case 'vehyb':
185
          case 'bing_hybrid':
186
              return  new OpenLayers.Layer.Bing({
187
                  name: "Hybrid",
188
                  key: apiKey,
189
                  type: "AerialWithLabels"
190
              });
191

    
192
          case 'veaer':
193
          case 'bing_arial':
194
              return  new OpenLayers.Layer.Bing({
195
                  name: "Aerial",
196
                  key: apiKey,
197
                  type: "Aerial"
198
              });
199

    
200
          */
201

    
202
        }
203

    
204
        return null;
205
      };
206

    
207

    
208
})();
209

    
(1-1/2)