forked from tombatossals/angular-leaflet-directive
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path0600-mixed-image-legend-example.html
101 lines (97 loc) · 4.27 KB
/
0600-mixed-image-legend-example.html
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<!DOCTYPE html>
<html ng-app="demoapp">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script src="http://maps.google.com/maps/api/js?v=3.2&sensor=false"></script>
<script src="../bower_components/angular/angular.min.js"></script>
<script src="../bower_components/leaflet/dist/leaflet.js"></script>
<script src="../bower_components/angular-simple-logger/dist/angular-simple-logger.js"></script>
<script src="../bower_components/leaflet-plugins/layer/tile/Google.js"></script>
<script src="../dist/angular-leaflet-directive.min.js"></script>
<link href='http://fonts.googleapis.com/css?family=Lato:400,700' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="../bower_components/leaflet/dist/leaflet.css" />
<script>
var app = angular.module("demoapp", ["leaflet-directive"]);
app.controller("ImageLegendServiceController", [ "$scope", function($scope) {
angular.extend($scope, {
options: {
controls: {
layers: {
visible: false
}
}
},
usa: {
lat: 39.931486,
lng: -101.406250,
zoom: 3
},
markers: {
m1: {
lat: 39.931486,
lng: -101.406250,
}
},
layers: {
baselayers: {
googleTerrain: {
name: 'Google Terrain',
layerType: 'TERRAIN',
type: 'google'
}
},
overlays: {
sst: {
name: 'Analyses - Sea Surface Temperature',
type: 'wms',
url: 'http://nowcoast.noaa.gov/wms/com.esri.wms.Esrimap/analyses',
visible: true,
layerOptions: {
layers: 'NCEP_RAS_ANAL_RTG_SST,NCEP_POLY_ANAL_RTG_SST',
format: 'image/png',
transparent: true,
attribution: 'NOAA/NOS nowCOAST',
}
},
wave: {
name: 'Forecasts - Wave height',
type: 'wms',
url: 'http://nowcoast.noaa.gov/wms/com.esri.wms.Esrimap/forecasts',
visible: false,
layerOptions: {
layers: 'NDFD_RAS_WAVEH_3_00,NDFD_POLY_WAVEH_3_00',
format: 'image/png',
transparent: true,
attribution: 'NOAA/NOS nowCOAST',
}
}
}
},
legend: {
url: "http://nowcoast.noaa.gov/LayerInfo?layer=NCEP_RAS_ANAL_RTG_SST&data=legend",
legendClass: "info legend",
position: "bottomleft",
type: "image"
},
legendURL1: "http://nowcoast.noaa.gov/LayerInfo?layer=NCEP_RAS_ANAL_RTG_SST&data=legend",
legendURL2: "http://nowcoast.noaa.gov/LayerInfo?layer=NDFD_RAS_WAVEH_3_00&data=legend",
switchLegend: function() {
$scope.layers.overlays.sst.visible = !$scope.layers.overlays.sst.visible;
$scope.layers.overlays.wave.visible = !$scope.layers.overlays.wave.visible;
$scope.legend.url == $scope.legendURL1? $scope.legendURL2:$scope.legendURL1;
}
});
}]);
</script>
</head>
<body ng-controller="ImageLegendServiceController">
<h1>Image Legend Service</h1>
<p>Use the button to switch another Layer with different legend.</p>
<leaflet lf-center="usa" layers="layers" markers="markers" height="480px" width="100%"
legend="legend" defaults="options"></leaflet>
<br/>
<button ng-click="switchLegend()">Switch Legend</button>
</body>
</html>