adds reverse geocoding to upload api

This commit is contained in:
Christian Beutel
2025-06-25 15:37:25 +02:00
parent 87334e2532
commit 4ab112e61b

View File

@@ -1,6 +1,7 @@
import GPX from "$lib/models/gpx/gpx";
import { haversineDistance } from "$lib/models/gpx/utils";
import type { Trail, TrailSearchResult } from "$lib/models/trail";
import { searchLocationReverse } from "$lib/stores/search_store";
import { trails_create } from "$lib/stores/trail_store";
import { handleError } from "$lib/util/api_util";
import { fromFile, gpx2trail } from "$lib/util/gpx_util";
@@ -40,6 +41,11 @@ export async function PUT(event: RequestEvent) {
}
}
if (trail.lat && trail.lon) {
const location = await searchLocationReverse(trail.lat, trail.lon)
trail.location ??= location;
}
// const log = new SummitLog(trail.date as string, {
// distance: trail.distance,
// elevation_gain: trail.elevation_gain,