/usr/share/doc/python-pyosmium/examples/pub_names.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 | """
Search for pubs in an osm file and list their names.
"""
import osmium
import sys
class NamesHandler(osmium.SimpleHandler):
def output_pubs(self, tags):
if 'amenity' in tags and tags['amenity'] == 'pub':
if 'name' in tags:
print(tags['name'])
def node(self, n):
self.output_pubs(n.tags)
def way(self, w):
self.output_pubs(w.tags)
if __name__ == '__main__':
if len(sys.argv) != 2:
print("Usage: python pub_names.py <osmfile>")
sys.exit(-1)
h = NamesHandler()
h.apply_file(sys.argv[1])
|