Skip to content

Commit

Permalink
fix leaflet: explicitly cast to float for position data
Browse files Browse the repository at this point in the history
This fixes not showing the position map with recent numpy versions.

Apparently the serialization for numpy changed resulting in this html
output:
var pos_datas = [[np.float64(48.43253), np.float64(9.233242)] ...

So we cast it explicitly to float.
  • Loading branch information
bkueng committed Oct 31, 2024
1 parent 76d98e6 commit e4127c8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/plot_app/leaflet.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def rgb_colors(flight_mode):
for i in range(len(pos_lon)):
curr_t = pos_t[i]
if (curr_t - last_t) / 1e6 > minimum_interval_s:
pos_datas.append([pos_lat[i], pos_lon[i]])
pos_datas.append([float(pos_lat[i]), float(pos_lon[i])])
last_t = curr_t
while current_flight_mode_idx < len(flight_mode_changes) - 1 and \
flight_mode_changes[current_flight_mode_idx][0] <= curr_t:
Expand Down

0 comments on commit e4127c8

Please sign in to comment.