summaryrefslogtreecommitdiffstats
path: root/parser_x.py
blob: 335068b359706fb12330284cbf9e22c67c621e12 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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")