/
mapserv.js
54 lines (43 loc) 路 1.25 KB
/
mapserv.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/*!
* wq.app 1.0.1-dev - wq/mapserv.js
* Extension to wq/map.js with support for WMS (coming soon) and ESRI services.
* (c) 2016-2017, S. Andrew Sheppard
* https://wq.io/license
*/
define(['wq/map', 'leaflet', 'esri-leaflet', 'leaflet.wms'],
function(map, L, esri, wms) {
map.addBasemapType('esri-basemap', function(conf) {
var layer;
if (conf.labels) {
layer = L.layerGroup([
esri.basemapLayer(conf.layer, conf),
esri.basemapLayer(conf.layer + 'Labels', conf)
]);
} else {
layer = esri.basemapLayer(conf.layer, conf);
}
return layer;
});
map.addBasemapType('esri-tiled', function(conf) {
return esri.tiledMapLayer(conf);
});
map.addOverlayType('esri-dynamic', function(conf) {
return esri.dynamicMapLayer(conf);
});
map.addOverlayType('esri-tiled', function(conf) {
return esri.tiledMapLayer(conf);
});
map.addOverlayType('esri-feature', function(conf) {
return esri.featureLayer(conf);
});
map.addBasemapType('wms-tiled', function(conf) {
return wms.tileLayer(conf.url, conf);
});
map.addOverlayType('wms', function(conf) {
return wms.overlay(conf.url, conf);
});
map.addOverlayType('wms-tiled', function(conf) {
return wms.tileLayer(conf.url, conf);
});
return map;
});