fix low level issues

This commit is contained in:
Davide Scaini
2026-03-31 23:22:12 +02:00
parent 8f91503cf7
commit 81438231b4
19 changed files with 126 additions and 44 deletions
+4 -4
View File
@@ -43,11 +43,11 @@ def preview_coords(
mask = rdp(coords, epsilon=0.001, return_mask=True)
reduced = [gps[i] for i, keep in enumerate(mask) if keep]
# Subsample if still too many
# Subsample if still too many — always include last point without exceeding max_points
if len(reduced) > max_points:
step = len(reduced) / max_points
reduced = [reduced[int(i * step)] for i in range(max_points)]
reduced.append(gps[-1]) # always include the last point
step = len(reduced) / (max_points - 1)
reduced = [reduced[int(i * step)] for i in range(max_points - 1)]
reduced.append(gps[-1])
return [[round(lat, 5), round(lon, 5)] for lat, lon in reduced]