summer_course_2024/geometry/geometry_feeders/osm_subway.py

23 lines
674 B
Python
Raw Normal View History

2020-06-30 16:51:49 -04:00
"""
OsmSubway module parses osm files and import the metro location into the city model structure
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
"""
import xmltodict
class OsmSubway:
def __init__(self, path):
with open(path) as osm:
self._osm = xmltodict.parse(osm.read(), force_list='tag')
for node in self._osm['osm']['node']:
if 'tag' not in node:
continue
for tag in node['tag']:
if '@v' not in tag:
continue
if tag['@v'] == 'subway_entrance':
print(tag['@v'])
print(node)