diff --git a/process_maps.py b/process_maps.py index 81f5689..125cec5 100755 --- a/process_maps.py +++ b/process_maps.py @@ -15,6 +15,7 @@ import subprocess, sys, os, pprint, datetime, argparse, time base_path = os.path.dirname(os.path.realpath(__file__)) +env = os.environ.copy() FNULL = open(os.devnull, 'w') @@ -65,13 +66,14 @@ if __name__ == '__main__': subprocess.run([bunzip2_cmd, os.path.join(dirpath, file)]) print('Processing maps using osmosis') + env['JAVACMD_OPTIONS'] = '-Djava.io.tmpdir=' + os.path.join(base_path, 'tmp') # Setup java temp dir to something a bit more sane (tmpfs /tmp for the loss) files_to_process = [] for dirpath, dirnames, filenames in os.walk('dl'): for file in filenames: print(' Found map: ', end='') print(os.path.join(dirpath, file)) files_to_process.append(os.path.join(dirpath, file)) - osmosis_cmd = [os.path.join(base_path, 'bin', 'osmosis', 'bin', 'osmosis'), '-Djava.io.tmpdir=' + os.path.join(base_path, 'tmp')] + osmosis_cmd = [os.path.join(base_path, 'bin', 'osmosis', 'bin', 'osmosis')] for file in files_to_process: if file.endswith('osm'): osmosis_cmd.extend(['--rx', 'file=' + file]) @@ -80,5 +82,6 @@ if __name__ == '__main__': for x in range(0, len(files_to_process) - 1): osmosis_cmd.append('--merge') osmosis_cmd.extend(['--mapfile-writer', 'file=output.map', 'type=hd']) - subprocess.run(osmosis_cmd) + cmd = subprocess.Popen(osmosis_cmd, env=env) + cmd.wait()