forked from openmaptiles/openmaptiles-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
generate-diagram-pngs
executable file
·31 lines (27 loc) · 1 KB
/
generate-diagram-pngs
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
#!/usr/bin/env python
"""
Usage:
generate-diagram-pngs <layer-definition>
generate-diagram-pngs --help
generate-diagram-pngs --version
Options:
--help Show this screen.
--version Show version.
"""
from docopt import docopt
import os.path
import openmaptiles
if __name__ == '__main__':
args = docopt(__doc__, version=openmaptiles.__version__)
layer_path = args['<layer-definition>']
layer_dir, layer_filename = os.path.split(layer_path)
layer_basename = layer_filename.split('.')[0]
os.system(f'generate-etlgraph {layer_path} {layer_dir}')
os.remove(os.path.join(layer_dir, f'etl_{layer_basename}.svg'))
os.remove(os.path.join(layer_dir, f'etl_{layer_basename}.dot'))
os.rename(
os.path.join(layer_dir, f'etl_{layer_basename}.png'),
os.path.join(layer_dir, 'etl_diagram.png')
)
os.system(f'generate-mapping-graph {layer_path} {os.path.join(layer_dir, "mapping_diagram")}')
os.remove(os.path.join(layer_dir, 'mapping_diagram'))