diff --git a/app/utils/gpx_processor.py b/app/utils/gpx_processor.py index 17b469b..7941490 100644 --- a/app/utils/gpx_processor.py +++ b/app/utils/gpx_processor.py @@ -325,7 +325,26 @@ def create_map_route_from_gpx(gpx_file_id: int) -> bool: total_distance += distance prev_point = point - # If no track points, try waypoints + # If no track points, try routes + if not all_coordinates: + for route in gpx.routes: + prev_point = None + + for point in route.points: + coord = [point.latitude, point.longitude] + all_coordinates.append(coord) + + if point.elevation is not None: + elevations.append(point.elevation) + + # Calculate distance + if prev_point: + distance = prev_point.distance_2d(point) + if distance: + total_distance += distance + prev_point = point + + # If no track or route points, try waypoints if not all_coordinates: for waypoint in gpx.waypoints: coord = [waypoint.latitude, waypoint.longitude]