Skip to content

Commit

Permalink
KML: Make <Document> optional
Browse files Browse the repository at this point in the history
Closes #3
  • Loading branch information
a3li committed Jul 17, 2024
1 parent f776d0a commit 82b5d89
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion mapbuilder/data/kml.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,16 @@ def parse_pos_list(raw_geometry):

def parse(self):
result = {}
self.parse_recursively(self.xml_root["kml"]["Document"], result)
self.parse_recursively(self.xml_root["kml"], result)
self.result = result
if self.root is not None and self.root in self.result:
self.result = self.result[self.root]
return self.result

def parse_recursively(self, root, result):
if "Document" in root:
self.parse_recursively(root["Document"], result)

if "Folder" in root:
for folder in ensure_list(root["Folder"]):
name = folder["name"]
Expand Down

0 comments on commit 82b5d89

Please sign in to comment.