Fix latitude/longitude string parsing in index_owntrack.html
- Convert string latitude/longitude to float before using in Leaflet - NocoDB returns coordinates as strings, causing Leaflet errors 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -127,18 +127,21 @@
|
|||||||
popupContent += `<br>🚗 Speed: ${speedKmh} km/h`;
|
popupContent += `<br>🚗 Speed: ${speedKmh} km/h`;
|
||||||
}
|
}
|
||||||
|
|
||||||
const marker = L.marker([loc.latitude, loc.longitude])
|
const lat = parseFloat(loc.latitude);
|
||||||
|
const lon = parseFloat(loc.longitude);
|
||||||
|
|
||||||
|
const marker = L.marker([lat, lon])
|
||||||
.addTo(map)
|
.addTo(map)
|
||||||
.bindPopup(popupContent)
|
.bindPopup(popupContent)
|
||||||
.openPopup();
|
.openPopup();
|
||||||
|
|
||||||
markers.push(marker);
|
markers.push(marker);
|
||||||
|
|
||||||
map.setView([loc.latitude, loc.longitude], 15);
|
map.setView([lat, lon], 15);
|
||||||
|
|
||||||
// Historie als Linie
|
// Historie als Linie
|
||||||
if (data.history && data.history.length > 1) {
|
if (data.history && data.history.length > 1) {
|
||||||
const coords = data.history.map(h => [h.latitude, h.longitude]);
|
const coords = data.history.map(h => [parseFloat(h.latitude), parseFloat(h.longitude)]);
|
||||||
const polyline = L.polyline(coords, {color: 'blue', weight: 3}).addTo(map);
|
const polyline = L.polyline(coords, {color: 'blue', weight: 3}).addTo(map);
|
||||||
polylines.push(polyline);
|
polylines.push(polyline);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user