forked from perliedman/query-overpass
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcli.js
More file actions
executable file
·28 lines (25 loc) · 738 Bytes
/
cli.js
File metadata and controls
executable file
·28 lines (25 loc) · 738 Bytes
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
#!/usr/bin/env node
var concat = require('concat-stream'),
argv = require('minimist')(process.argv.slice(2), {
string: 'overpass-url',
boolean: 'flat-properties',
default: {
'flat-properties': false
}
}),
fs = require('fs'),
overpass = require('./');
function openData(s) {
var query = s.toString();
overpass(query, function(err, geojson) {
if (!err) {
console.log(JSON.stringify(geojson));
} else {
console.log(err);
}
}, {
overpassUrl: argv['overpass-url'],
flatProperties: argv['flat-properties']
});
}
((argv._[0] && fs.createReadStream(argv._[0])) || process.stdin).pipe(concat(openData));