from objects import Node, NodeTag, Way, WayTag class OSM: def __init__(self, _osmContent): self.osmContent = str(_osmContent) self.nodeList = [] self.nodeTagList = [] self.wayList = [] self.wayTagList = [] self.parseOsmContent() def parseOsmContent(self): lines = self.osmContent.split("\n") nodeLines = [] wayLines = [] for line in lines: if "" in line: try: self.createNode([line]) except: print("Node could not be inserted") else: nodeLines.append(line) elif "" in line: try: self.createNode(nodeLines) except: print("Node could not be inserted") nodeLines = [] elif len(nodeLines) > 0: nodeLines.append(line) elif "" in line: try: self.createWay(wayLines) except: print("Way could not be inserted") wayLines = [] elif len(wayLines) > 0: wayLines.append(line) def createWay(self, lines): wayId = "" for line in lines: if "