Skip to content

Commit 4f0b470

Browse files
authored
improve GPX parsing error message (#712)
1 parent 8fd99ee commit 4f0b470

2 files changed

Lines changed: 14 additions & 2 deletions

File tree

mapillary_tools/geotag/geotag_images_from_gpx_file.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,13 @@ def __init__(
2525
num_processes: T.Optional[int] = None,
2626
):
2727
super().__init__()
28-
tracks = parse_gpx(source_path)
28+
try:
29+
tracks = parse_gpx(source_path)
30+
except Exception as ex:
31+
raise RuntimeError(
32+
f"Error parsing GPX {source_path}: {ex.__class__.__name__}: {ex}"
33+
)
34+
2935
if 1 < len(tracks):
3036
LOG.warning(
3137
"Found %s tracks in the GPX file %s. Will merge points in all the tracks as a single track for interpolation",

mapillary_tools/video_data_extraction/extractors/gpx_parser.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,13 @@ def extract_points(self) -> T.Sequence[geo.Point]:
2020
if not path:
2121
return []
2222

23-
gpx_tracks = geotag_images_from_gpx_file.parse_gpx(path)
23+
try:
24+
gpx_tracks = geotag_images_from_gpx_file.parse_gpx(path)
25+
except Exception as ex:
26+
raise RuntimeError(
27+
f"Error parsing GPX {path}: {ex.__class__.__name__}: {ex}"
28+
)
29+
2430
if 1 < len(gpx_tracks):
2531
LOG.warning(
2632
"Found %s tracks in the GPX file %s. Will merge points in all the tracks as a single track for interpolation",

0 commit comments

Comments
 (0)