correct elevation for summit logs

This commit is contained in:
Christian Beutel
2025-08-20 13:34:55 +02:00
parent e3916e371a
commit 097ecd409d
6 changed files with 19 additions and 14 deletions

View File

@@ -18,18 +18,21 @@ import { handleFromRecordWithIRI } from "./activitypub_util";
import { Waypoint } from "$lib/models/waypoint";
export function gpx2trail(gpxString: string, fallbackName?: string, f: (url: RequestInfo | URL, config?: RequestInit) => Promise<Response> = fetch) {
export async function gpx2trail(gpxString: string, fallbackName?: string, correctElevation: boolean = false, f: (url: RequestInfo | URL, config?: RequestInit) => Promise<Response> = fetch) {
const gpx = GPX.parse(gpxString);
if (gpx instanceof Error) {
throw gpx;
}
// try {
// await gpx.correctElevation(f)
// } catch(e) {
// console.warn("Unable to correct elevation: " + e)
// }
if (correctElevation) {
try {
await gpx.correctElevation(f)
} catch (e) {
console.warn("Unable to correct elevation: " + e)
}
}
const trail = new Trail("");