fixes here and there
This commit is contained in:
@@ -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];
|
||||
}
|
||||
Reference in New Issue
Block a user