Skip to content

Commit

Permalink
add more sample data
Browse files Browse the repository at this point in the history
  • Loading branch information
JerrySievert committed Feb 4, 2014
1 parent f3b6796 commit 57d72a6
Show file tree
Hide file tree
Showing 3 changed files with 171,061 additions and 0 deletions.
34 changes: 34 additions & 0 deletions data/convert.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
var fs = require('fs');

if (process.argv.length !== 4) {
console.log("USAGE: node convert.js infile outfile");
process.exit(1);
}

var inFile = process.argv[2],
outFile = process.argv[3];


var inData = fs.readFileSync(inFile, 'utf8');

var lines = inData.split("\n");

var out = "create_collection('us_cities');\n";

for (var i = 0; i < lines.length; i++) {
var parts = lines[i].split(",");

var obj = {
"Country": parts[0],
"City": parts[1],
"Region": parts[2],
"Latitude": Number(parts[3]),
"Longitude": Number(parts[4])
};

out += "SELECT save('us_cities', '" + JSON.stringify(obj) + "');\n";
}

fs.writeFileSync(outFile, out, 'utf8');

console.log("done!");
Loading

0 comments on commit 57d72a6

Please sign in to comment.