You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Pathway of long-distance fiber-optic internet service provider cabling, as followed by Google Streetview. Coast-to-coast line (New York Stock Exchange to Googleplex)
CODE (node js): var fs = require('fs'); var request = require('request');
var points = //your list of long/lang pairs. //example; [[-74.01211,40.70727], [-74.01297,40.70623], [-74.0131,40.70609], [-74.01323,40.70597], [-74.01381,40.70524], [-74.01386,40.70519], [-74.01389,40.70513], [-74.01393,40.70508], [-74.01402,40.70493], [-74.01407,40.70478], [-74.01409,40.70475], [-74.0141,40.70472], [-74.01422,40.7046], [-74.01424,40.70462]]; //obtainable from any hand-made google map by selecting 'export to kmz' in 'share', or programmaticaly by signing up to a paid maps api
var counter = 0;
var running = setInterval(function(){ going(counter) counter ++; if (counter === points.length) { cleanup(); htmlmaker(); clearInterval(running); } }, 500);
function going(counter){
var squareimage = "https://maps.googleapis.com/maps/api/streetview?size=150x150&location=" + points[counter][1]+","+points[counter][0]+"&fov=50&heading=45&pitch=-90&key=YOURKEY";
for (d=0;d<15000;d++){ try { fs.accessSync('square/'+d+'.png', fs.F_OK); } catch (e) { console.log(d + " does not exist- trying again"); going(d) } } }
function htmlmaker(){ var html;
for (c=0;c<15001;c++){ html = html + "<img src="+c+".png>";
if (c==15000){ var data = fs.readFileSync("collector.html"); // make a blank file named this var fd = fs.openSync("collector.html", 'w+'); var buffer = new Buffer(html); fs.writeSync(fd, buffer, 0, buffer.length); fs.writeSync(fd, data, 0, data.length); fs.close(fd); } }
}
The text was updated successfully, but these errors were encountered:
A thoroughfare [] beat Across the wilderness
Pathway of long-distance fiber-optic internet service provider cabling, as followed by Google Streetview. Coast-to-coast line (New York Stock Exchange to Googleplex)
A necessary thank-you to Ramakrishnan Durairajan, Paul Barford, Joel Sommers, and Walter Willinger for their whitepaper InterTubes: A Study of the US Long-haul Fiber-optic Infrastructure
PDF of book
CODE (node js):
var fs = require('fs');
var request = require('request');
var points =
//your list of long/lang pairs.
//example; [[-74.01211,40.70727], [-74.01297,40.70623], [-74.0131,40.70609], [-74.01323,40.70597], [-74.01381,40.70524], [-74.01386,40.70519], [-74.01389,40.70513], [-74.01393,40.70508], [-74.01402,40.70493], [-74.01407,40.70478], [-74.01409,40.70475], [-74.0141,40.70472], [-74.01422,40.7046], [-74.01424,40.70462]];
//obtainable from any hand-made google map by selecting 'export to kmz' in 'share', or programmaticaly by signing up to a paid maps api
var counter = 0;
var running = setInterval(function(){ going(counter)
counter ++;
if (counter === points.length) {
cleanup();
htmlmaker();
clearInterval(running);
}
}, 500);
function going(counter){
var squareimage = "https://maps.googleapis.com/maps/api/streetview?size=150x150&location=" + points[counter][1]+","+points[counter][0]+"&fov=50&heading=45&pitch=-90&key=YOURKEY";
request(squareimage, {encoding: 'binary'}, function(error, response, body) {fs.writeFile('square/'+counter+'.png', body, 'binary', function (err) {});});
console.log(counter)
}
function cleanup(){
for (d=0;d<15000;d++){
try {
fs.accessSync('square/'+d+'.png', fs.F_OK);
} catch (e) {
console.log(d + " does not exist- trying again");
going(d)
}
}
}
function htmlmaker(){
var html;
for (c=0;c<15001;c++){
html = html + "<img src="+c+".png>";
if (c==15000){
var data = fs.readFileSync("collector.html"); // make a blank file named this
var fd = fs.openSync("collector.html", 'w+');
var buffer = new Buffer(html);
fs.writeSync(fd, buffer, 0, buffer.length);
fs.writeSync(fd, data, 0, data.length);
fs.close(fd);
}
}
}
The text was updated successfully, but these errors were encountered: