Skip to content

Commit b9c4a97

Browse files
peterbarkertridge
authored andcommitted
kmlread.py: correct for id coming from cascadingstyle not style
1 parent 6a099f6 commit b9c4a97

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

MAVProxy/modules/lib/kmlread.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@
1111
import pathlib
1212
import re
1313

14-
namespaces = {'kml': 'http://www.opengis.net/kml/2.2'}
14+
namespaces = {
15+
'kml': 'http://www.opengis.net/kml/2.2',
16+
'gx': 'http://www.google.com/kml/ext/2.2',
17+
}
1518

1619

1720
class Style():
@@ -167,8 +170,9 @@ def parse(self):
167170

168171
# extract styles:
169172
self.style = {}
170-
for s in self.tree.findall(".//kml:Style", namespaces):
171-
_id = s.get("id")
173+
for s in self.tree.findall(".//gx:CascadingStyle", namespaces):
174+
idname = f"{{{namespaces['kml']}}}id"
175+
_id = s.get(idname)
172176
style = Style(_id)
173177
self.style[_id] = style
174178
line_style = find_tag_recursive(s, 'LineStyle')

0 commit comments

Comments
 (0)