From 842f378822dfcd58a9178319ed0752a11baa52c8 Mon Sep 17 00:00:00 2001 From: Mike C Date: Sun, 28 Aug 2016 14:05:11 -0400 Subject: [PATCH] Added POI processing using mapsforge POI writer --- process_maps.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/process_maps.py b/process_maps.py index 125cec5..2d9ef2c 100755 --- a/process_maps.py +++ b/process_maps.py @@ -65,7 +65,7 @@ if __name__ == '__main__': print(file) subprocess.run([bunzip2_cmd, os.path.join(dirpath, file)]) - print('Processing maps using osmosis') + # Setup various runtime aspects (going to do multiple osmosis runs (maps AND POIs) 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'): @@ -73,6 +73,8 @@ if __name__ == '__main__': print(' Found map: ', end='') print(os.path.join(dirpath, file)) files_to_process.append(os.path.join(dirpath, file)) + + print('Processing maps using osmosis') osmosis_cmd = [os.path.join(base_path, 'bin', 'osmosis', 'bin', 'osmosis')] for file in files_to_process: if file.endswith('osm'): @@ -85,3 +87,16 @@ if __name__ == '__main__': cmd = subprocess.Popen(osmosis_cmd, env=env) cmd.wait() + print('Processing POIs using osmosis') + 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]) + elif file.endswith('pbf'): + osmosis_cmd.extend(['--rb', 'file=' + file]) + for x in range(0, len(files_to_process) - 1): + osmosis_cmd.append('--merge') + osmosis_cmd.extend(['--poi-writer', 'file=output.poi', 'tag-conf-file=' + os.path.join(base_path, 'poi-mapping.xml')]) + cmd = subprocess.Popen(osmosis_cmd, env=env) + cmd.wait() +