-
Notifications
You must be signed in to change notification settings - Fork 5
/
upload.ejs
378 lines (322 loc) · 17.3 KB
/
upload.ejs
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
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
<!DOCTYPE html>
<html lang="en">
<head>
<title>SnapperGPS - Upload</title>
<link rel="shortcut icon" href="images/favicon.ico" type="image/x-icon" />
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.7.1/dist/leaflet.css" integrity="sha512-xodZBNTC5n17Xt2atTPuE1HxjVMSvLVW9ocqUKLsCC5CXdbqCmblAshOMAS6/keqq/sMZMZ19scR4PsZChSR7A==" crossorigin=""/>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BmbxuPwQa2lc/FVzBcNJ7UAyJxM6wuqIj61tLrc4wSX0szH/Ev+nYRRuWlolflfl" crossorigin="anonymous">
<link rel="stylesheet" href="css/style.css" />
<link rel="stylesheet" href="css/upload.css" />
<script src="js/deviceCommunication.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Upload the data from your SnapperGPS receiver after a completed deployment.">
</head>
<body>
<!-- Nav bar -->
<%- include ('partials/navBar', {pageName: 'upload'}) %>
<!-- Main body -->
<main class="container">
<div class="row">
<div class="col">
<h1>Upload the data from your SnapperGPS receiver after a
completed deployment</h1>
</div>
</div>
<div class="row" style="margin-bottom: 20px;"">
<div class="col">
<i>
Did you know that this site works offline, too?
You can transfer data from your SnapperGPS receiver
to your computer in the field.
(If you do not clear your browser cache.)
</i>
</div>
</div>
<div class="row bg-white">
<div>
<%- include ('partials/webUsbSupport') %>
</div>
<div id="error-card" style="display: none;">
<div class="card text-white bg-danger mb-3" style="max-width: 100%;">
<div class="card-header"><b>Error</b></div>
<div class="card-body">
<p class="card-text" id="error-text">Error</p>
</div>
</div>
</div>
</div>
<div class="row bg-light">
<div class="row">
<div class="col">
Connect your SnapperGPS receiver
via USB.
If you used SnapperGPS before, then you can see some information
from your SnapperGPS receiver below.
Otherwise, click <i>Pair receiver</i> and select your SnapperGPS
receiver from the list.
</div>
</div>
<div class="row-ident">
<%- include ('partials/deviceInfo') %>
</div>
<div class="row btnrow row-ident">
<div class="col btncol">
<button class="btn btn-primary full-width" id="pair-button" style="min-width: 175px" disabled>Pair receiver</button>
</div>
</div>
</div>
<div class="row bg-light">
<div class="row">
<div class="col">
You have the option to transfer the raw data from your
SnapperGPS receiver to your device.
You can
upload it to our server later, which then calculates the track.
However, if you have an internet connection, then you
most likely want to skip this step and
upload your data
immediately.
<!-- If you transfer the data, you will be provided with a .json
and a .zip file, which contain identical information.
Therefore, it is sufficient to keep only one of both
(preferably, the .json file). -->
</div>
</div>
<div class="row btnrow row-ident">
<div class="col btncol">
<button class="btn btn-primary full-width" id="transfer-button" style="min-width: 175px" disabled>Transfer data</button>
</div>
</div>
<div class="row row-ident">
<div class="col">
<span id="snapshot-count-transfer">
0 snapshots transferred.
</span>
<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true" style="display: none; margin-left: 5px" id="transfer-spinner"></span>
</div>
</div>
</div>
<div class="row bg-light">
<div class="row">
<div class="col">
If you want to upload the data from your SnapperGPS
receiver, then
provide a rough location where the deployment started.
Either select a location on the map or
enter its latitude and longitude.
</div>
</div>
<div class="row row-ident">
<div class="col">
<div class="map-holder">
<div class="map" id="start-map" style="z-index: 1;"></div>
<canvas class="map-canvas" id="start-map-canvas" style="z-index: 2; display: none;"></canvas>
</div>
</div>
</div>
<div class="row row-ident btnrow">
<div class="col-auto btncol">
<label for="start-latitude-input">Latitude:</label>
<input id="start-latitude-input" type="number" placeholder="00.000000" style="width: 8em;">
<label for="start-latitude-input">° N</label>
</div>
<div class="col-auto btncol">
<label for="start-longitude-input">Longitude:</label>
<input id="start-longitude-input" type="number" placeholder="000.000000" style="width: 8em;">
<label for="start-latitude-input">° E</label>
</div>
</div>
</div>
<div class="row bg-light">
<div class="row">
<div class="col">
If your actual deployment began later than the receiver
started to capture data, then provide a start date and
time. Snapshots before the start date and after the end
date will be excluded from processing. This speeds up
processing, especially, if the receiver recorded its
first data indoors. Additionally, if the first snapshots
contain no or very few satellites, then this can harm
the reliability
of all subsequent estimates. Therefore, choose a start
time that is likely to have a good view of the sky.
</div>
</div>
<div class="row btnrow row-ident">
<div class="col-auto btncol">
<label for="start-date-input" style="margin-right: 10px;">Start:</label>
<input id="start-date-input" type="date">
<input id="start-time-input" type="time" value="00:00">
<label id="start-timezone" for="start-time-input"></label>
</div>
<div class="col-auto btncol">
<label for="end-date-input" style="margin-right: 10px;">End:</label>
<input id="end-date-input" type="date">
<input id="end-time-input" type="time" value="00:00">
<label id="end-timezone" for="end-time-input"></label>
</div>
</div>
</div>
<div class="row bg-light">
<div class="row">
<div class="col">
You can optionally
provide an expected maximum velocity of your SnapperGPS
receiver to improve outlier detection.
</div>
</div>
<div class="row row-ident">
<div class="col">
<label for="velocity-input" style="margin-right: 10px;" id="velocity-input-label">Max. velocity:</label>
<input id="velocity-input" type="number" value="" min="0"
style="width: 70px; text-align: right;">
<select id="velocity-unit-input" style="height: 30px;">
<option value="m/s">metres/second</option>
<option value="km/h">kilometres/hour</option>
<option value="mph">miles/hour</option>
</select>
</div>
</div>
</div>
<div class="row bg-light">
<div class="row">
<div class="col">
To be notified once our server is done with
processing your data and calculating your track,
you have three options:
<ul>
<li>
Enter your e-mail address.
We will only use it for this purpose and delete it
afterwards.
</li>
<li>
Subscribe to our Telegram bot
<a class="text-link" href="https://t.me/SnapperGPSBot">@SnapperGPSBot</a>
after you have uploaded your data.
</li>
<li>
Receive a push notification on this device.
</li>
</ul>
</div>
</div>
<div class="row row-ident">
<div class="col">
<label for="email-input" style="margin-right: 10px;">E-mail:</label>
<input id="email-input" type="email">
</div>
</div>
<div class="row row-ident">
<div class="col">
<label for="notification-checkbox" style="margin-right: 10px; color: lightgray;" id="notification-label">Push notification:</label>
<input type="checkbox" id="notification-checkbox" disabled>
</div>
</div>
</div>
<div class="row bg-light">
<div class="row">
<div class="col">
Optionally, choose a nickname for your upload.
</div>
</div>
<div class="row row-ident">
<div class="col">
<label for="nickname-input" style="margin-right: 10px;">Nickname:</label>
<input id="nickname-input" type="text">
</div>
</div>
</div>
<div class="row bg-light">
<div class="row">
<div class="col">
Choose if you want to upload data to the server
that you saved earlier
<!--, either a single .json file (preferred) or all .bin files from the .zip folder, -->
or if
you want to directly upload data from a connected SnapperGPS
receiver.
</div>
</div>
<div class="row row-ident">
<div class="col">
<input id="file-input" type="file" accept=".bin,.json" multiple>
</div>
</div>
<div class="row row-ident" hidden>
<div class="col">
<div class="form-check">
<input type="radio" class="form-check-input confidence-radio" name="priority-radio" id="priority-immediate-radio" value="0">
<label class="form-check-label" for="priority-immediate-radio">
Immediate processing.
</label>
<p>
(Data will be processed as soon as the server has
the capacaity.
Location estimates for data from the day of your
upload might be missing or of low quality.)
</p>
</div>
<div class="form-check">
<input type="radio" class="form-check-input confidence-radio" name="priority-radio" id="priority-rapid-radio" value="1" checked>
<label class="form-check-label" for="priority-rapid-radio">
Rapid processing.
</label>
<p>
(Data will be processed no earlier than the
afternoon of the last day of your recording.
Location estimates for data from the day of your
upload might be of lower quality.)
</p>
</div>
<div class="form-check">
<input type="radio" class="form-check-input confidence-radio" name="priority-radio" id="priority-delayed-radio" value="2">
<label class="form-check-label" for="priority-delayed-radio">
Delayed processing.
</label>
<p>
(Data will be processed no earlier than the
afternoon of the day after the last day of your
recording.)
</p>
</div>
</div>
</div>
<div class="row btnrow row-ident">
<div class="col">
<button class="btn btn-primary full-width btncol" id="upload-selected-button" disabled>Upload selected files</button>
<button class="btn btn-primary full-width btncol" id="upload-device-button" style="min-width: 175px" disabled>Upload from receiver</button>
</div>
</div>
<div class="row row-ident">
<div class="col">
<span id="snapshot-count-upload">
0 snapshots uploaded.
</span>
<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true" style="display: none; margin-left: 5px" id="upload-selected-spinner"></span>
<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true" style="display: none; margin-left: 5px" id="upload-device-spinner"></span>
</div>
</div>
</div>
<div class="row bg-white">
<div class="col">
<a class="text-link" href="/privacy">Privacy policy</a>
</div>
</div>
</main>
</body>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://unpkg.com/leaflet@1.7.1/dist/leaflet.js" integrity="sha512-XQoYMqMTK8LvdxXYG3nZ448hOEQiglfqkJs1NOQV44cWnUrBc8PkAOcXy20w0vlaXaVUearIOBhiXZ5V3ynxwA==" crossorigin=""></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta2/dist/js/bootstrap.bundle.min.js" integrity="sha384-b5kHyXgcpbZJO/tY9Ul7kGkf1S0CWuKcCD38l8YkeH8z8QjE0GmW1gYU5S9FOnJ0" crossorigin="anonymous"></script>
<!-- Load Esri Leaflet from CDN -->
<script src="https://cdn-geoweb.s3.amazonaws.com/esri-leaflet/1.0.0-rc.2/esri-leaflet.js"></script>
<!-- Geocoding Control -->
<script src="https://cdn-geoweb.s3.amazonaws.com/esri-leaflet-geocoder/0.0.1-beta.5/esri-leaflet-geocoder.js"></script>
<link rel="stylesheet" type="text/css" href="https://cdn-geoweb.s3.amazonaws.com/esri-leaflet-geocoder/0.0.1-beta.5/esri-leaflet-geocoder.css">
<script src="jszip.min.js"></script>
<script src="FileSaver.js"></script>
<script src="js/serverCommunication.js"></script>
<script src="js/upload/uploadComms.js"></script>
<script src="service-worker.js"></script>
<script src="js/upload/uploadUI.js"></script>
</html>