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