Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kmlread: fixed multiple polys with same name #1369

Merged
merged 1 commit into from
May 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions MAVProxy/modules/mavproxy_kmlread.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,7 @@ def loadkml(self, filename):
nodes = kmlread.readkmz(filename)

self.snap_points = []
counter = 0

#go through each object in the kml...
if nodes is None:
Expand All @@ -295,14 +296,17 @@ def loadkml(self, filename):
if point is None:
continue

counter += 1

#and place any polygons on the map
if self.mpstate.map is not None and point[0] == 'Polygon':
self.snap_points.extend(point[2])

#print("Adding " + point[1])
newcolour = (random.randint(0, 255), 0, random.randint(0, 255))
curpoly = mp_slipmap.SlipPolygon(point[1], point[2],
layer=2, linewidth=2, colour=newcolour)
curpoly = mp_slipmap.SlipPolygon(point[1]+"-"+str(counter),
point[2],
layer=2, linewidth=2, colour=newcolour)
self.mpstate.map.add_object(curpoly)
self.allayers.append(curpoly)
self.curlayers.append(point[1])
Expand Down
Loading