Added POI processing using mapsforge POI writer

This commit is contained in:
Mike C 2016-08-28 14:05:11 -04:00
parent 5c1f108854
commit 842f378822

View file

@ -65,7 +65,7 @@ if __name__ == '__main__':
print(file) print(file)
subprocess.run([bunzip2_cmd, os.path.join(dirpath, 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) 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 = [] files_to_process = []
for dirpath, dirnames, filenames in os.walk('dl'): for dirpath, dirnames, filenames in os.walk('dl'):
@ -73,6 +73,8 @@ 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))
print('Processing maps using osmosis')
osmosis_cmd = [os.path.join(base_path, 'bin', 'osmosis', 'bin', 'osmosis')] osmosis_cmd = [os.path.join(base_path, 'bin', 'osmosis', 'bin', 'osmosis')]
for file in files_to_process: for file in files_to_process:
if file.endswith('osm'): if file.endswith('osm'):
@ -85,3 +87,16 @@ if __name__ == '__main__':
cmd = subprocess.Popen(osmosis_cmd, env=env) cmd = subprocess.Popen(osmosis_cmd, env=env)
cmd.wait() 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()