forked from blueaccounting/charts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathErieStat_Map_FWMC_S.html
215 lines (188 loc) · 7.08 KB
/
ErieStat_Map_FWMC_S.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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Spring Flow-Weighted Mean Concentration in ErieStat Watersheds</title>
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.3.1/dist/leaflet.css">
<script src="https://code.jquery.com/jquery-3.1.1.js"></script>
<script src="https://unpkg.com/leaflet@1.3.1/dist/leaflet.js"></script>
<!-- Load Esri Leaflet from CDN -->
<script src="https://unpkg.com/esri-leaflet@2.1.3/dist/esri-leaflet.js"></script>
<script src="//code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<!--<!– Optional theme –>-->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">
<!--<!– Latest compiled and minified JavaScript –>-->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<script src="js/ba_chart2.js"></script>
<script src="js/export-csv_glc.js"></script>
<link rel="stylesheet" href="css/BA_Style.css">
</head>
<body>
<style>
/*.label div {*/
/*color: black;*/
/*position: relative;*/
/*left: -70%;*/
/*font-size: 12px;*/
/*font-style: italic;*/
/*!*text-shadow: 0px 2px 1px rgba(255,255,255,0.85);*!*/
/*}*/
/*#legend {*/
/*z-index: 99;*/
/*position: absolute;*/
/*padding: 15px;*/
/*margin-bottom: 5%;*/
/*left: 10px;*/
/*bottom: 5%;*/
/*height: 20px;*/
/*width: 100px;*/
/*background: rgba(255, 255, 255, 0.8);*/
/*color: black;*/
/*}*/
</style>
<div>
<div id="map"></div>
<!--<div id="legend">Legend here</div>-->
<div class="vl"></div>
<div id="right-panel">
<div id="intro"></div>
<div id="narrative-section">
<p id="narrative-caption"></p>
<p id="narrative-content"></p>
</div>
<div id="chart-canvas">
<div id="upperChart"></div>
</div>
<!--<div id="lowerCanvas">-->
<!--<div id="lowerChart"></div>-->
<!--</div>-->
</div>
</div>
<script>
var data;
var serviceURL = "https://gis.glc.org/server/rest/services/ErieStat/SpringSRP/MapServer";
var metric = metrics.SRP_FWMC_S;
$("#intro").html(intro_FWMC);
$.getJSON("data/all_data2.json", function(d){
data = d;
});
var map = L.map("map").setView([42.1, -83.1], 8);
L.esri.basemapLayer("Topographic").addTo(map);
var watersheds = L.esri.dynamicMapLayer({
url: serviceURL,
layers:[0, 1, 2],
f: "image",
opacity: 0.7
}).addTo(map);
var boundary_query = L.esri.query({
url: serviceURL + "/0"
});
boundary_query.bounds(function(error, latlngbounds){
map.fitBounds(latlngbounds);
});
// var query = L.esri.query({
// url: 'https://gis.glc.org/server/rest/services/ErieStat/PriorityWatersheds/MapServer/1'
// });
var selectedFeature;
map.on("click", function (e){
if(selectedFeature){
map.removeLayer(selectedFeature);
}
watersheds.identify().on(map).at(e.latlng).layers("visible:1").simplify(map, 0.5).run(function (error, featureCollection){
if(featureCollection.features.length >0){
$("#intro").css("visibility", "hidden");
for(var i = 0; i < featureCollection.features.length; i++){
selectedFeature = L.geoJSON(featureCollection.features[i]);
selectedFeature.setStyle({
fill: false,
weight: 4,
// color: "#07fcf0"
color: "#F3A51E"
});
selectedFeature.addTo(map);
var name = featureCollection.features[i].properties["Watershed Name"];
buildNarratives(name);
var temp = window.innerHeight - $("#narrative-section").height() - 300;
buildChart(data, "upperChart", name, metric, units[metric], null, (window.innerHeight - $("#narrative-section").height()) * 0.8);
// query.where("MergeNm='"+ name +"'").bounds(function(error, latLngBounds, response){
// map.fitBounds(latLngBounds);
// });
break;
}
}
})
});
// $.ajax({
// url: serviceURL + "/legend?f=json",
//
// }).then(function(legendJson){
// var content = "<br>";
// var json = JSON.parse(legendJson);
// for(var i = 0; i < json.layers.length; i++){
//
// }
// var j = legendJson;
//
// });
/*****
* Section added for labels
*/
// var labels = {};
// var pilotWatersheds = L.esri.featureLayer({
// url: 'https://gis.glc.org/server/rest/services/ErieStat/PriorityWatersheds/MapServer/1',
// style: function(feature){
// return {
// opacity: 0,
// fill: false
// }
// }
// }).addTo(map);
// pilotWatersheds.on('createfeature', function(e){
// var id = e.feature.id;
// var feature = pilotWatersheds.getFeature(id);
// var center = feature.getBounds().getCenter();
// var label = L.marker(center, {
// icon: L.divIcon({
// iconSize: null,
// className: 'label',
// html: '<div>' + e.feature.properties.MergeNm + '</div>'
// })
// }).addTo(map);
// labels[id] = label;
// });
// pilotWatersheds.on('addfeature', function(e){
// var label = labels[e.feature.id];
// if(label){
// label.addTo(map);
// }
// });
//
// pilotWatersheds.on('removefeature', function(e){
// var label = labels[e.feature.id];
// if(label){
// map.removeLayer(label);
// }
// });
/***
* End of section
* */
// function findFeatureLayer(featureCol){
// for(var i = 0; i < featureCol.features.length; i++){
// if(featureCol.features[i].layerId == 1){
// var name = featureCol.features[i].properties["Watershed Name"];
// buildChart("upperChart", name);
// buildNarratives(name);
// query.where("MergeNm='"+ name +"'").bounds(function(error, latLngBounds, response){
// map.fitBounds(latLngBounds);
// });
// return i;
// }
// }
// return null;
// }
</script>
</body>
</html>