get waypoint elevation

This commit is contained in:
vcoppe
2024-06-13 17:52:36 +02:00
parent b29500cfeb
commit 639586d5ac
2 changed files with 7 additions and 2 deletions

View File

@@ -338,9 +338,13 @@ export class GPXLayer {
let waypoint = get(currentPopupWaypoint)?.[0];
if (waypoint) {
let marker = this.markers[waypoint._data.index];
if (marker) {
if (this.map.project(marker.getLngLat()).dist(this.map.project(e.lngLat)) > 100) {
this.hideWaypointPopup();
}
} else {
this.hideWaypointPopup();
}
}
}

View File

@@ -131,7 +131,8 @@
lon: longitude
}
});
// TODO get elevation for waypoint
waypoint.ele =
get(map)?.queryTerrainElevation([longitude, latitude], { exaggerated: false }) ?? 0;
dbUtils.applyToFiles(
Array.from(fileIds),
(file) => file.replaceWaypoints(file.wpt.length, file.wpt.length, [waypoint])[0]