Ask someone how many countries they have been to and they will usually pause, count on their fingers, and get it slightly wrong. The odd thing is that their phone already knows. It has been in every one of those countries, and it took photos there.
I build Driftlog, an iPhone app that turns that into a list without anyone typing anything. In Japan the same app is called ずぼ旅 (Zubotabi). This post is about how it works: recording in the background without wrecking the battery, deciding which country a point is in without a network, telling the towns you stayed in from the towns you drove through, and why "how many states have I been to" is harder than it sounds.
Disclosure up front: it is my app, and it is a paid one (one purchase, no subscription). The engineering below stands on its own, and there is a free browser tool at the end.
The short version
- What it is: Driftlog: Countries Visited, for iPhone and iPad (iOS 17 or later), with an Android version. Called ずぼ旅 (Zubotabi) on the Japanese App Store.
- What it records: the countries, regions (US states, Japanese prefectures, provinces), cities and dates you visit, in the background, on a world map.
- Old trips: rebuilt from the location and date saved in your photos. It reads the metadata, never the picture.
- Where the data lives: on the phone. There is no account and no server holding your history, and the App Store privacy label lists no location data.
- Price: free to download. The free version opens your first three regions at home and your first foreign country in full; everywhere else still fills in on the map and in the count. One purchase of $6.99 unlocks the rest.
1. Recording without draining the battery
Continuous GPS is out of the question for an app that runs for months. Driftlog uses significant location change monitoring (startMonitoringSignificantLocationChanges()), with desiredAccuracy set to a kilometre. It is a coarse signal, driven mostly by cell towers and Wi-Fi, and iOS wakes the app only after the device has moved a meaningful distance (Apple describes it as roughly 500 metres or more). That is exactly the granularity a "which city am I in" app needs, and the battery cost is close to nothing.
Two things I learned the hard way:
-
It needs Always permission, full stop. With When In Use, significant-change monitoring returns
kCLErrorDeniedand delivers nothing. An early build showed "Recording: On" to people who had granted When In Use, while recording nothing at all. Now the app only claims to record when it actually can, and with When In Use it takes a single fix each time the app comes to the foreground. -
You do not need
allowsBackgroundLocationUpdatesfor significant changes; iOS relaunches the app in the background on its own. I still declare thelocationbackground mode, because App Review rejected a build without it as "unable to verify the setting".
2. Which country is this point in, with no network?
The obvious answer is reverse geocoding: hand the coordinate to CLGeocoder and read the country back. That works until someone switches off roaming, which travellers do all the time. Early on, a trip taken with roaming off did not appear until the person reached Wi-Fi and opened the app.
So the country is now decided on the device, from border data bundled with the app (derived from Natural Earth):
- A small bounding-box index (about 8 KB) narrows a point down to one to three candidate countries.
- Only those countries' first-level administrative polygons are loaded, lazily, and the point is tested against them.
- If several countries match, the smallest one wins. Without this rule, Vatican City, San Marino and Lesotho, which sit entirely inside another country, would quietly disappear.
- A point that lands in no polygon but within about 8 km of land is snapped to the nearest outline. Coastlines are where most photos are taken, and where simplified borders are least accurate.
CLGeocoder is still used, but only for the name of the town, and it has a quota you will hit when importing years of photos. The system log spells it out: more than 50 requests in 60 seconds gets throttled. Each lookup only takes 60 to 80 ms, so the slowness was self-inflicted. The first version fired one request every 250 ms, burned the whole window in 12.5 seconds and failed for the remaining 47:
| Strategy | Succeeded | Throttled |
|---|---|---|
| Fixed 250 ms interval, 30 requests | 7 | 23 |
| Sliding 60-second window, 60 requests | 60 | 0 |
Photo import, background repair and live recording now share one actor that hands out slots from a single window, capped at 45 to leave room. While the window has space, requests go out at full speed; when it is full, the caller waits only until the oldest request ages out. One more trap: a cancelled task's Task.sleep throws immediately, so a while loop wrapped around try? await Task.sleep turns into a busy loop that pins the CPU at 100% the moment the user cancels an import. Check Task.isCancelled first.
3. The road-trip problem: towns you stayed in vs towns you drove through
While you are driving, location fixes arrive roughly every five minutes, and each one lands near a different highway town. On a measured day trip from Los Angeles to San Diego and back in September 2026 (3 hours 15 minutes each way), the first version listed fourteen "visited" towns; seven of the eleven rows were places the car only drove past. Meanwhile Santa Monica, the real stop of the day at 74 minutes stationary, had been merged into Los Angeles and was gone. The places you went disappeared and the places you passed stayed.
The rule now is that dropping a town needs evidence, not keeping it:
- You stayed if you were stationary for at least 15 minutes within 1 km. In measurements, towns passed on the highway peaked at 9 minutes (traffic), and real stops started at 59, so 15 leaves room for "parked and walked around the block".
- Photos can also prove a stay, but the count is not enough: it takes 3 photos spread over at least 5 minutes, within 5 km. One or two shots out of the car window do not spread out in time; getting out and walking does.
- Location only arrives when you move, so a night in a hotel looks like zero minutes: an arrival fix, then nothing until you leave the next morning. If the next fix is within 10 km, the stay counts up to the moment you would have had to leave to walk there at 5 km/h. Any faster way of travelling means you left later, so the estimate never runs long.
- If the evidence is missing, the town stays. Keeping a town you only drove through is a small annoyance; deleting a town you actually visited breaks the one thing the app is for.
4. "How many states have I been to?" is two different questions
For the US the answer is clean: the map has 51 areas, the 50 states plus Washington, D.C., and the app shows how many of the 51 you have been to.
Elsewhere it gets messy, because the map's regions and the region name the geocoder returns often come from different levels of government:
| Country | Polygons on the map | Regions the geocoder returns |
|---|---|---|
| United Kingdom | 225 districts | 4 (England, Scotland, Wales, Northern Ireland) |
| France | 101 départements | 18 régions |
| Italy | 110 provinces | 20 regions |
| Kenya | 8 former provinces | 47 counties |
Put "12 / 225" next to two region chips on the same screen and the record looks broken, so for countries where the two levels disagree, the app does not show a denominator at all. For countries where they agree, it trusts the geocoder's region name and settles border towns by majority vote. That fixed a resort town in Nagano being painted in neighbouring Gunma, because the simplified outline rounds to 400 m.
5. Old trips, from photo metadata
PhotoKit gives each asset a location and a creationDate. That is all Driftlog reads; it never loads the image itself. Only photos and videos you took count: received photos, synced images and screenshots are skipped, since they say nothing about where you were.
Splitting the library into trips is easy abroad: the country changes. At home it does not, and my first attempt fused every domestic observation into a single trip, "Canada, 2024–2026, 900 days". Worse, that giant trip overlapped every new candidate, so the duplicate check refused to import a single domestic trip. Now, at home, an observation more than two days away from a trip's dates starts a new trip (two days being long enough to have gone home in between), and one more than 150 km from every city on the trip counts as a different destination (roughly one state or province over). The home area itself is only inferred from places you spent at least 14 days in, so a long holiday is not mistaken for where you live.
Two honest limits: a photo taken with camera location off is invisible, and a trip you took no photos on stays missing until you add it by hand.
6. What leaves the phone
Coordinates go to Apple's geocoder to become place names. The country is worked out on the phone, and the travel history itself never leaves the device. There is no server of mine holding it and nothing to sign in to.
The free part
If you only want the number once, you do not need the app. The Driftlog Counter at counter.getdriftlog.com reads the GPS coordinates in your photo files or a Google Maps Timeline export inside your browser, tests them against country borders and draws the map. Nothing is uploaded, there are no analytics and no cookies, and the code is on GitHub under the MIT licence. There is a version for US states too.
Questions people ask
Is there an iPhone app that automatically tracks the countries I've visited?
Yes. Driftlog records countries, regions and cities in the background and rebuilds earlier trips from your photos. Polarsteps also records automatically, but it tracks routes for a travel journal rather than keeping a country list. Most other country trackers are maps you fill in by hand.
How can I find out how many countries I've been to from my iPhone photos?
Three ways: browse the map in the Photos app and count by hand; drop your photos into the free Driftlog Counter, which counts them in your browser; or install Driftlog, which reads the photo locations on the phone and keeps the list updating.
Is there an app that tracks the US states I've visited automatically?
Driftlog colors in the states from where you have been and from your photos, out of 51 (the 50 states and D.C.). If you want counties or national parks, a manual app such as USA Travel: I've Been in US is the better fit; I compare them on this page.
What is ずぼ旅 (Zubotabi)?
The Japanese name of Driftlog. It is the same app, sold under that name on the Japanese App Store.
Does it need an account or a subscription?
No account, no subscription. It is free to download, and one purchase unlocks everything.
Links: Driftlog on the App Store · getdriftlog.com · comparison of twenty travel trackers
I'm Aki Takashima, a solo developer in Alberta, Canada. Questions about any of the above are welcome in the comments.
Top comments (0)