-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmapparser.py
More file actions
39 lines (28 loc) · 838 Bytes
/
mapparser.py
File metadata and controls
39 lines (28 loc) · 838 Bytes
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
37
38
39
import xml.etree.cElementTree as ET
import pprint
import config
OSM_PATH = config.osm_filename
def count_tags(filename):
tag_dict={}
tree = ET.parse(filename)
root = tree.getroot()
#print(type(root))
tag_list=[]
for child in root:
tag_list.append(child.tag)
for baby in child:
tag_list.append(baby.tag)
#print(tag_list)
count=0
tag_set=set(tag_list)
for utag in tag_set:
for tag in tag_list:
if(tag==utag):
count+=1
tag_dict[utag]=count
count=0
tag_dict['osm']=1
#print(tag_dict)
return tag_dict
tag_dict = count_tags(OSM_PATH)
pprint.pprint(tag_dict)