forked from alykat/snowzilla-traffic
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmapcapture.js
53 lines (42 loc) · 1.01 KB
/
mapcapture.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
var intervalLength = 300000;
function screenCap() {
loadMap();
// loadRadar();
}
function loadMap() {
var page = require('webpage').create();
page.viewportSize = {
width: 1200,
height: 1200
};
page.open('https://www.google.com/maps/@38.6337794,-76.8123652,6z/data=!5m1!1e1', function(success) {
var timestamp = (new Date()).toLocaleString();
console.log(success, timestamp);
if(success) {
map_wait(timestamp);
}
});
function map_wait(timestamp) {
setTimeout(function() {
page.render('screengrabs/map-' + timestamp + '.png');
}, 5000);
}
}
function loadRadar() {
var page = require('webpage').create();
page.viewportSize = {
width: 1200,
height: 1200
};
page.open('http://project.wnyc.org/storm-radar/', function() {
radar_wait();
});
function radar_wait() {
setTimeout(function() {
var timestamp = (new Date()).toLocaleString();
page.render('screengrabs/radar-' + timestamp + '.png');
}, 5000);
}
}
screenCap();
var interval = setInterval(screenCap, intervalLength);