-
Notifications
You must be signed in to change notification settings - Fork 13
/
index.js
60 lines (35 loc) · 1.32 KB
/
index.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
54
55
56
57
58
59
60
#!/usr/bin/env node
const CommandLineArgs = require("command-line-args");
const CommandLineUsage = require("command-line-usage");
const commandLineOptions = require("./src/command-line-options");
const usageSections = require("./src/usage-sections");
const VTProcessor = require("./src/core/VTProcessor");
const Log = require("./src/core/Log");
try {
const options = CommandLineArgs(commandLineOptions);
if (options.help) {
const usage = CommandLineUsage(usageSections);
console.log(usage);
} else if (options.mbtiles) {
if (options.style) {
VTProcessor.slim(options.mbtiles, options.style, options.out);
} else if (options.tolerance) {
VTProcessor.simplifyTileLayer(options.mbtiles, parseInt(options.zoom),
parseInt(options.column), parseInt(options.row),
options.layer, parseFloat(options.tolerance));
} else if (options.row) {
VTProcessor.showTileInfo(options.mbtiles, parseInt(options.zoom),
parseInt(options.column), parseInt(options.row));
} else {
// Examination mode
VTProcessor.showInfo(options.mbtiles);
}
} else if (options.PBFUrl) {
VTProcessor.showURLTileInfo(options.PBFUrl, parseInt(options.zoom),
parseInt(options.column), parseInt(options.row));
} else {
Log.info("Wrong usage. Use -h to see the valid arguments.");
}
} catch (err) {
Log.error(err);
}