-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.html
192 lines (175 loc) · 8.11 KB
/
index.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<!--Edit the title of the page-->
<title>Human Water Security Survey</title>
<meta name="description" content="Human Water Security Survey for SIWI">
<meta name="author" content="Florian Lengyel and Luan Tian">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<link rel="shortcut icon" href="http://cartodb.com/assets/favicon.ico" />
<link rel="stylesheet" href="http://libs.cartocdn.com/cartodb.js/v3/themes/css/cartodb.css" />
<!--[if lte IE 8]>
<link rel="stylesheet" href="http://libs.cartocdn.com/cartodb.js/v3/themes/css/cartodb.ie.css" />
<![endif]-->
<!--Switch between the different themes changing the stylesheet below - light-theme.css |dark-theme.css -->
<link rel="stylesheet" href="css/light-theme.css">
<link rel="stylesheet" href="css/makeitresponsive.css">
<!-- Bootstrap CSS -->
<!--
<link href="bootstrap/css/bootstrap.min.css" rel="stylesheet" media="screen">
<link href="bootstrap/css/bootstrap-responsive.css" rel="stylesheet">
-->
<!-- CartoDB CSS -->
<link rel="stylesheet" href="http://libs.cartocdn.com/cartodb.js/v2/themes/css/cartodb.css" />
<!--[if lte IE 8]>
<link rel="stylesheet" href="http://libs.cartocdn.com/cartodb.js/v2/themes/css/cartodb.ie.css" />
<![endif]-->
<!-- Leaflet CSS -->
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.6.4/leaflet.css" />
<!--[if lte IE 8]>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.6.4/leaflet.ie.css" />
<![endif]-->
<!-- Google Maps (for basemap) -->
<script src="https://maps.googleapis.com/maps/api/js?sensor=false"></script>
<!-- cartodb.js library (must be loaded after Google Maps) -->
<script src="http://libs.cartocdn.com/cartodb.js/v3/cartodb.uncompressed.js"></script>
<!-- jQuery -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js"></script>
<!-- Leaflet -->
<script src="http://cdn.leafletjs.com/leaflet-0.6.4/leaflet.js"></script>
<script type="text/javascript" src="js/wax.leaf.min.js"></script>
<script type="text/javascript" src="dist/cartodb-leaflet-min.js"></script>
<script type="text/javascript" src="dist/cartodb-popup-min.js"></script>
<style>
#map { height: 700px; padding: 0; margin: 0; }
#map img { max-width: none; }
<!-- #map img tag fixes CartoDB CSS problem in FireFox. Note that
the fix is sensitive to the placement of comments in the CSS!!! -->
</style>
</head>
<body>
<div class="map" id="map"></div>
<div class="sidepanel">
<div class="wrapper">
<div class="context subheader">
<p>Map created by <a href="http://asrc.cuny.edu/crossroads">CUNY Advanced Science Research Center</a></p>
</div>
<h1>Human Water Security</h1>
<p>This interactive survey of Human Water Security (HWS) is
based on the first global-scale initiative to quantify the
impact of human-induced stressors on human water security
and riverine biodiversity
<a href="#Nature2010">(Vörösmarty, 2010)</a>.
The map illustrates global threats
to Human Water Security (HWS) accounting for beneficial
investments in water infrastructure and management such
as dams, sustainable water use practices, improved access
to water resources, and improvements in clean drinking
water supplies.
</p>
<!--Copy and paste the div below for creating content blocks-->
<h3>Instructions</h3>
<p>
Researchers at the
<a href="http://asrc.cuny.edu/crossroads">CUNY Advanced Science Research Center</a> and <a href="http://www.cuahsi.org">CUAHSI</a>
seek your opinion of the water resources accessible to you. You
may select your location on the map, provide your opinion, tell
your story about the water resources in your area, and provide a
link to a picture on social media.
</p>
<h3>Sources</h3>
<p>
C. J. Vörösmarty, P. B. McIntyre, M. O. Gessner, D. Dudgeon,
A. Prusevich, P. Green, S. Glidden, S. E. Bunn, C. A. Sullivan,
C. Reidy Liermann & P. M. Davies.
<a name="Nature2010">
<a href="http://www.nature.com/nature/journal/v467/n7315/full/nature09440.html#/supplementary-information">
<i>Global threats to human water security and river biodiversity.</i>
</a></a>
Nature <strong>467</strong>, 555–561 (30 September 2010).
</p>
Further information can be obtained from <a href="http://riverthreat.net">riverthreat.net</a>
<div class="context footer">
<p>
<a href="http://www.cuahsi.org"><img src="img/cuahsi_logo_sm.gif" alt="http://www.cuahsi.org/" style="border-width:0"/></a>
<a href="http://www.cuny.edu"><img src="img/cuny-logo.gif" alt="www.cuny.edu" style="border-width:0"/></a>
<a href="http://asrc.cuny.edu"><img src="img/cuny-asrc-logo.png" alt="asrc.cuny.edu" style="border-width:0"/></a>
<!--
<script src="bootstrap/js/bootstrap.min.js"></script>
-->
</p>
</div>
</div>
</div>
<script type="text/javascript">
HWS = window.HWS || {}; // in case we move to backbone
marker = HWS.marker || {}; // belongs in model, in any case
window.onload = function() {
cartodb.createVis('map', 'http://asrc.cartodb.com/api/v2/viz/9cfc68f0-ea4d-11e2-8078-3085a9a9563c/viz.json', {
sharable: true,
//title: true,
description:true,
search:true,
tiles_loader: true,
center_lat: 0,
center_lon: 0,
zoom: 3,
infowindow: false
})
.done(function(vis, layers) {
// layer 0 is the base layer
// layer 1 is the cartodb layer
// setInteraction disabled by default
layers[1].setInteraction(true);
layers[1].on('featureOver', function(e, latlng, pos, data) {
document.body.style.cursor = 'pointer';
console.log('MouseHover::'+'pos:'+pos+' latlng:'+latlng+
' cartdb_id:'+data.cartodb_id);
});
layers[1].on('featureOut', function(ev, latlng, pos, data) {
document.body.style.cursor = 'default';
// you may want to "trigger" an event
});
layers[1].on('featureClick', function(e, latlng, pos, data) {
document.body.style.cursor = 'default';
HWS.map = vis.getNativeMap();
var marker = new google.maps.Marker({
position: new google.maps.LatLng(latlng[0],latlng[1]),
map: HWS.map,
title: 'x:'+latlng[0].toFixed(3)+', y:'+latlng[1].toFixed(3),
});
if (HWS.marker) { // if there is a previous
HWS.marker.setMap(null); // destroy the previous
}
marker.setMap(HWS.map);
HWS.marker = marker;
console.log('Mouseclick::'+'pos:'+pos+' latlng:'+latlng+
' cartdb_id:'+data.cartodb_id);
// NOTE: to get the HWS value we must do a query
var sql = new cartodb.SQL({ user: 'asrc' });
sql.execute("SELECT ST_AsGeoJSON(the_geom),value FROM adjusted_hws_threat WHERE cartodb_id = " + data.cartodb_id)
.done(function(data) {
// we illustrate how to get the values
// we will later insert a user selected value
console.log(data.rows, data.rows[0].st_asgeojson,
data.rows[0].value, latlng);
})
.error(function(errors) {
// errors contains a list of errors
console.log("error:" + err);
})
});
// if you need the map variable, get it
// map = vis.getNativeMap();
// add map.whatever() to set zoom, etc
map = vis.getNativeMap();
})
.error(function(err) {
console.log(err);
});
}
</script>
</body>
</html>