summaryrefslogtreecommitdiffstats
path: root/parser_x.py
diff options
context:
space:
mode:
Diffstat (limited to 'parser_x.py')
-rw-r--r--parser_x.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/parser_x.py b/parser_x.py
new file mode 100644
index 0000000..335068b
--- /dev/null
+++ b/parser_x.py
@@ -0,0 +1,24 @@
+# Parser example
+# Usage python parser_ex.py
+
+import sys
+from datetime import datetime
+
+from osm_parser import get_default_parser
+
+# The first argument after the python module on the commandline
+filename = sys.argv[1]
+
+# Parse the supplied OSM file
+start = datetime.now()
+
+parser = get_default_parser(filename)
+
+nodes = 0
+for node in parser.iter_nodes():
+ nodes += 1
+
+end = datetime.now()
+
+print("The data contains", nodes, "nodes")
+print("Parsing the data took", (end - start).total_seconds(), "seconds")