/usr/share/doc/python-pyosmium/examples/convert.py is in python-pyosmium 2.6.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | """
Converts a file from one format to another.
This example shows how to write objects to a file.
"""
import osmium as o
import sys
class Convert(o.SimpleHandler):
def __init__(self, writer):
o.SimpleHandler.__init__(self)
self.writer = writer
def node(self, n):
self.writer.add_node(n)
def way(self, w):
self.writer.add_way(w)
def relation(self, r):
self.writer.add_relation(r)
if __name__ == '__main__':
if len(sys.argv) != 3:
print("Usage: python convert.py <infile> <outfile>")
sys.exit(-1)
writer = o.SimpleWriter(sys.argv[2])
handler = Convert(writer)
handler.apply_file(sys.argv[1])
writer.close()
|