Skip to content

Use the file time by default for images with GPS but no capture time - #989

Merged
caglarpir merged 1 commit into
mapillary:mainfrom
caglarpir:file-time-fallback-by-default
Dec 3, 2026
Merged

caglarpir merged 1 commit into
mapillary:mainfrom
caglarpir:file-time-fallback-by-default

Conversation

@caglarpir

Copy link
Copy Markdown
Contributor

Problem

#975 added --use_file_time_as_capture_time for images with a GPS position but no capture time, as an opt-in. Without the option such images still fail with Unable to extract timestamp from the image, so a tool that runs process with its defaults, such as the Desktop Uploader, still can't upload them.

Change

  • process and process_and_upload now give such an image its file time by default: the earlier of its modification and creation times (on Linux, the modification time). It comes with the same warning, and the same MapillaryFileTimeWarning in the process report, as with the option before.
  • New --no_file_time_as_capture_time makes such an image fail, with Unable to extract timestamp from the image: it has a GPS position but no capture time. Write the capture time into the image (with ExifTool, for example).
  • --use_file_time_as_capture_time is removed. It was never in a release.
  • Unchanged:
    • video_process never uses file times.
    • Images placed on a GPX or NMEA track, images without GPS, and images with placeholder or pre-1970 dates fail as before.
    • A date that ExifTool reads, such as XMP-xmp:CreateDate, still wins over the file time.
    • When a sequence fails as too fast, the error still says if some of its times are file times. It no longer names the removed option.

The cost: a downloaded, exported or copied file has the time of the copy. Such images are uploaded with that date, or fail as too fast when they were copied in one go.

How tested

  • Two panoramas with GPS and no date:

    • On main, process fails both (exit 6).
    • With this change, process with no options gives each its file creation time, with one warning each (exit 0). The descriptions are identical to main's with --use_file_time_as_capture_time.
    • With --no_file_time_as_capture_time, both fail with the message above.
  • Same results as main for:

    • an image dated only in XMP-xmp:CreateDate, which keeps that date;
    • an image without GPS, which fails;
    • --geotag_source gpx, which fails.
  • video_process --no_file_time_as_capture_time and process --use_file_time_as_capture_time are refused as unknown options.

  • Tests:

    • the value each command passes for the option, with and without the flag (none for video_process);
    • a default process run and its report;
    • the error with the flag.

    Each test was checked to fail with its part of the change reverted.

  • Full suite on Python 3.9 and 3.13, ruff, usort, mypy.

An image with a GPS position of its own but no capture time in its
metadata now gets the earlier of its file modification and creation times
by default, with a warning and a MapillaryFileTimeWarning in the process
report, so that process and process_and_upload take such images without an
option. --no_file_time_as_capture_time fails them instead, as before.

--use_file_time_as_capture_time is gone: it was never released.
video_process still never uses file times: its frames get their times from
the video.
@meta-cla meta-cla Bot added the cla signed label Dec 2, 2026
@caglarpir
caglarpir merged commit 4117dda into mapillary:main Dec 3, 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