-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakegis.js
executable file
·39 lines (31 loc) · 1 KB
/
makegis.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
/*jslint node: true */
/*jslint es5: true */
/*jslint nomen: true */
/*global setImmediate */
"use strict";
var w2g = require('./lib/win2gis'),
fs = require('graceful-fs'),
path = require('path'),
argv = require('yargs'),
moment = require('moment'),
settings;
settings = argv
.usage('Converteert de win2 dump bestanden in json naar gis-csv.\nUsage: $0')
.example('$0 file.json [morefiles.json ...]',
'Maakt per json bestand een matchend .csv bestande met de essentiele csv data.')
.demand(1)
.argv;
function doConvert() {
console.log("hoera %j", settings);
// TODO loop through all inputs
settings._.forEach(function (fpath) {
if (!fs.existsSync(fpath)) {
console.log("skipp not existing path %s", fpath);
return;
} //else
var dir = path.dirname(fpath), name = path.basename(fpath, path.extname(fpath)),
out = path.join(dir, name + ".csv");
w2g.convert(fpath, out);
});
}
doConvert();