ROHAN

NOTES / DATA

Extracting geolocation from image EXIF at scale, and why the metadata lies

2026-02

EXIF geolocation looks like free structured data — the coordinates are just sitting there in the file, no inference required. The catch is that "sitting there" doesn't mean "correct," and a pipeline that trusts it blindly will confidently place assets in the wrong location often enough to matter.

The ways it goes wrong

Some devices don't write GPS EXIF at all, and a naive extractor treats a missing field as a silent skip — fine, as long as everything downstream expects gaps. Others write stale coordinates: a phone that acquired a GPS fix at the start of a shoot and never updated it will tag every photo from that session with the first location, not the actual one per shot. Editing software and messaging apps frequently strip EXIF entirely on save or forward, which means the "no location" case includes both "never had one" and "had one, lost it in transit" — two very different situations that look identical by the time the file reaches your pipeline.

And then there's outright implausible data: malformed GPS blocks that decode to coordinates in the middle of an ocean, or a reference (N/S/E/W) that got flipped during a lossy conversion somewhere upstream, putting a location in the wrong hemisphere entirely.

What a validation pass actually checks

Extraction has to be paired with sanity-checking, not just parsing. A useful minimum: bounds-check the decoded coordinates against any known context you have (a country, a region, a project boundary) and reject or flag anything outside plausible range. Cross-check GPS timestamp against file creation time where both exist — a large mismatch is a signal something's off, not proof, but a signal worth surfacing. Track "no EXIF GPS" and "implausible EXIF GPS" as separate categories in your logs instead of collapsing both into a null value; they call for different downstream handling and conflating them means you can't tell how much of your data you should actually trust.

The part that's easy to skip

None of this shows up as a bug in testing with a handful of curated sample images — those are exactly the images that behave. The failure only appears at volume, with real field-collected assets from a mix of devices, which is precisely the case a pipeline like this exists to handle. Building the validation pass in from the start costs less than retrofitting it after the first time a bad coordinate makes it into a report.