Skip to content

Keep the gaps between GPX track segments inside a video in its description - #986

Merged
caglarpir merged 1 commit into
mapillary:mainfrom
caglarpir:keep-gpx-segment-gaps
Dec 2, 2026
Merged

caglarpir merged 1 commit into
mapillary:mainfrom
caglarpir:keep-gpx-segment-gaps

Conversation

@caglarpir

@caglarpir caglarpir commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

GPS loggers, such as the Mapillary apps, start a new GPX track segment (<trkseg>) where they lost the GPS. process merged the segments into one track, so a video was placed on a straight line across the gap.

The gaps now go into the description of the video as MAPGPSTrackGaps. Each gap is given by the times of the points on either side of it, in milliseconds of video, as in MAPGPSTrack.

  • A gap counts only inside the video, and only where the next segment starts more than MAPILLARY_TOOLS_MAX_GPX_SEGMENT_GAP_SECONDS (5) after the previous one ends, with no point of another segment in between. Segments that overlap, such as the tracks of two loggers merged into one file, leave no gap where they overlap, and segments that touch (one starting when the other ends) leave none. Neither affects the other gaps of the file.
  • Where the start or the end of the video falls in such a gap, process interpolated a point there across the gap. The fixes on the far side are now left out instead, as for a gap of more than MAPILLARY_TOOLS_MAX_GPX_GAP_SECONDS: the video has no position until the first fix after the gap, or after the last fix before it. A video entirely inside a gap then has no GPS points, and fails to process.
  • The track of a video without a GPS clock that lasts twice as long as the video or more keeps no gap, as it may be that of a timelapse.
  • Only process keeps gaps. Sampling (video_process) is not changed here, and still places frames across them.

Uploads are unchanged here: #988 uploads each part between the gaps as its own sequence. A GPX file with no segment gap of more than 5 seconds gives the same description as before.

mapillary_tools 0.15.2 and older refuse a description with MAPGPSTrackGaps (the schema allows no other properties), so upload with an older version stops on such a description file. This is meant to land together with #988.

…ption

GPS loggers, such as the Mapillary apps, start a new GPX track segment
where they lost the GPS. process merged the segments into one track,
whose interpolation across the gap places the video there on a straight
line, as if the GPS had been there.

The GPX video extractor now keeps the boundaries between the segments of
the track file, and process writes those inside the video to its
description as MAPGPSTrackGaps: the times, in milliseconds of video, of
the points on either side of each gap. A boundary counts where the next
segment starts more than MAPILLARY_TOOLS_MAX_GPX_SEGMENT_GAP_SECONDS (5)
after the previous one ends, so a logger that splits its track every few
fixes leaves none, and where no point of another segment is in between:
segments that overlap, as two loggers' tracks merged into one file do,
leave none there, and segments that touch leave none. The track of a
video without a GPS clock that lasts twice as long as the video or more
keeps no gap, as it may be that of a timelapse.

Where the start or the end of the video falls in such a gap, process
interpolated a point there across the gap. The fixes on the far side of
the gap are now left out instead, as for a gap of more than
MAPILLARY_TOOLS_MAX_GPX_GAP_SECONDS: the video has no position until the
first fix after the gap, or after the last one before it.

The warning about a GPX file of several segments counted them as tracks,
and said they were merged into one: it now counts segments, and process
says that gaps of more than the limit between them inside a video are
kept as gaps.

Sampling is not changed here: it still places frames across these gaps.
Uploads are unchanged too: uploading each part of the video between the
gaps as its own sequence comes in a follow-up.
@caglarpir
caglarpir force-pushed the keep-gpx-segment-gaps branch from f5f2cc7 to 21c84cf Compare December 1, 2026 16:45
@caglarpir
caglarpir merged commit a1f9417 into mapillary:main Dec 2, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant