fixes here and there

This commit is contained in:
2026-01-25 12:55:30 +01:00
parent bd5a59d827
commit 6300de22f0
4 changed files with 366 additions and 329 deletions

View File

@@ -39,4 +39,14 @@ export function formatDistance(meters, useImperial = false) {
*/
export function formatBearing(degrees) {
return `${degrees.toFixed(1)}°`;
}
/**
* Convert web Mercator to lat/long
*/
export function webMercatorToLonLat(x, y) {
const R = 6378137;
const lon = (x / R) * (180 / Math.PI);
const lat = (2 * Math.atan(Math.exp(y / R)) - Math.PI / 2) * (180 / Math.PI);
return [lon, lat];
}