Add ability to specify output file names

This commit is contained in:
Mike C 2018-02-25 14:01:12 -05:00
parent a8d1138199
commit c4b65ada73

View file

@ -34,6 +34,8 @@ if __name__ == '__main__':
help='use RAM for mapsforge processing -- WARNING mapsforge uses 10x the map size in RAM for processing (ie. 100Mb map = 1Gb RAM usage), you want a LOT of RAM for this option') help='use RAM for mapsforge processing -- WARNING mapsforge uses 10x the map size in RAM for processing (ie. 100Mb map = 1Gb RAM usage), you want a LOT of RAM for this option')
parser.add_argument('--max-heap-space', action='store', default='4g', parser.add_argument('--max-heap-space', action='store', default='4g',
help='set the max heap space for the JVM, use standard -Xmx values, default (4g) should be fine if not using --use-ram argument') help='set the max heap space for the JVM, use standard -Xmx values, default (4g) should be fine if not using --use-ram argument')
parser.add_argument('--output-map-name', action='store', default='output',
help='set the output .map and .poi file names')
#TODO: Add argument to pass path to osmosis #TODO: Add argument to pass path to osmosis
#TODO: Add argument to pass path to output dir #TODO: Add argument to pass path to output dir
args = parser.parse_args() args = parser.parse_args()
@ -91,7 +93,7 @@ if __name__ == '__main__':
osmosis_cmd.extend(['--rb', 'file=' + file]) osmosis_cmd.extend(['--rb', 'file=' + file])
for x in range(0, len(files_to_process) - 1): for x in range(0, len(files_to_process) - 1):
osmosis_cmd.append('--merge') osmosis_cmd.append('--merge')
osmosis_cmd.extend(['--mapfile-writer', 'file=output.map']) osmosis_cmd.extend(['--mapfile-writer', 'file=' + args.output_map_name + '.map'])
if args.use_ram: if args.use_ram:
osmosis_cmd.extend(['type=ram']) osmosis_cmd.extend(['type=ram'])
else: else:
@ -108,7 +110,7 @@ if __name__ == '__main__':
osmosis_cmd.extend(['--rb', 'file=' + file]) osmosis_cmd.extend(['--rb', 'file=' + file])
for x in range(0, len(files_to_process) - 1): for x in range(0, len(files_to_process) - 1):
osmosis_cmd.append('--merge') osmosis_cmd.append('--merge')
osmosis_cmd.extend(['--poi-writer', 'file=output.poi', 'tag-conf-file=' + os.path.join(base_path, 'poi-mapping.xml')]) osmosis_cmd.extend(['--poi-writer', 'file=' + args.output_map_name + '.poi', 'tag-conf-file=' + os.path.join(base_path, 'poi-mapping.xml')])
cmd = subprocess.Popen(osmosis_cmd, env=env) cmd = subprocess.Popen(osmosis_cmd, env=env)
cmd.wait() cmd.wait()