Added on-disk processing of maps due to in-memory being "too big" for "large" map processing

This commit is contained in:
Mike C 2016-01-12 17:20:07 -05:00
parent c69f8515b2
commit 9f36e8e948
2 changed files with 5 additions and 2 deletions

1
.gitignore vendored
View file

@ -1,3 +1,4 @@
out/ out/
test/ test/
tmp/
*.swp *.swp

View file

@ -26,6 +26,8 @@ if __name__ == '__main__':
map_list.append(line.strip()) map_list.append(line.strip())
print('Creating working directories') print('Creating working directories')
if not os.path.exists('tmp'):
os.makedirs('tmp')
if not os.path.exists('out'): if not os.path.exists('out'):
os.makedirs('out') os.makedirs('out')
os.chdir('out') os.chdir('out')
@ -58,7 +60,7 @@ if __name__ == '__main__':
print(' Found map: ', end='') print(' Found map: ', end='')
print(os.path.join(dirpath, file)) print(os.path.join(dirpath, file))
files_to_process.append(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')] osmosis_cmd = [os.path.join(base_path, 'bin', 'osmosis', 'bin', 'osmosis', '-Djava.io.tmpdir=' + os.path.join(base_path), 'tmp')]
for file in files_to_process: for file in files_to_process:
if file.endswith('osm'): if file.endswith('osm'):
osmosis_cmd.extend(['--rx', 'file=' + file]) osmosis_cmd.extend(['--rx', 'file=' + file])
@ -66,6 +68,6 @@ 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=output.map', 'type=hd'])
subprocess.run(osmosis_cmd) subprocess.run(osmosis_cmd)