Takeout JSON

Add a Location to Photos Without GPS Data

How to write GPS coordinates into photos that have none, by typing a city name or coordinates, and why a place name in the file helps later.

Your camera has no GPS. Or the phone had location off. Or the photos went through a messaging app that stripped it. Whatever the reason, a chunk of your library has no place attached, and "photos from Lisbon" means scrolling by eye.

Why the location is missing

Most dedicated cameras never had GPS. Phones do, but only record it if location services were on for the camera app, and many people turn that off. Scans have no location. Anything sent through WhatsApp, Messenger or most email clients arrives with the GPS removed on purpose. Google Takeout photos may have GPS in the .json sidecar but not in the file, which is its own problem, covered in /blog/google-takeout-missing-location-gps.

Some photos never had a location and never will. That is fine. The question is whether you know where they were taken. If you do, you can write it in.

Where a location lives in a photo

In EXIF, as four tags: GPSLatitude, GPSLatitudeRef (N or S), GPSLongitude, GPSLongitudeRef (E or W). Altitude is optional. That is all a "geotagged" photo is. Once those four tags are set, every photo app shows the pin on a map, groups by place and lets you search by city.

Photo apps do not store a place name in the file. They look one up from the coordinates when they need it. This matters below.

Coordinates or a city name

You need coordinates to write into EXIF. You probably know a place name. Converting a name to coordinates is called geocoding, and any map site does it: search for the town, right-click the spot, copy the numbers. For a town-level location, the centre of town is fine.

Be honest about precision. If you know the city but not the street, use the city centre. Apps will show "Lisbon", which is true. Putting a pin on a specific building you are guessing at is worse than a vague one.

Writing GPS by hand

exiftool sets the four tags on one file or a whole folder:

exiftool -GPSLatitude=38.7223 -GPSLatitudeRef=N -GPSLongitude=9.1393 -GPSLongitudeRef=W -overwrite_original .

Positive latitude is north, positive longitude is east. If a map gives you -9.1393, that is 9.1393 west, so the ref is W and the value is written without the sign.

digiKam has a geolocation editor with a map. Select photos, drag them onto the map, save. It works on Windows, macOS and Linux and is free. On a Mac, Apple Photos lets you assign a location to a selection, but it keeps it in its own database unless you export with location included. XnView MP can write GPS in its metadata editor.

Do a folder at a time. Photos from one trip share a location well enough. Photos from a whole year do not.

Why put the place name in the filename too

Coordinates are for software. A place name is for you. 2019-07-14-1105_Lisbon.jpg tells you where it is without opening anything, on a NAS listing, in a terminal, on a TV. It survives even if some tool strips EXIF later.

Getting from coordinates to a name is reverse geocoding, and it needs a lookup service or a local database. This is the one step that cannot be done fully offline without a big download. /blog/photos-by-location-folders goes into it.

Doing it with the app

Takeout JSON Metadata Fixer has a folder-level location setting for exactly this. For a folder of photos with no GPS, you type one place and it is written into every photo.

Type a city name or paste coordinates. The app writes the GPS tags into each photo's EXIF, alongside a date if you set one. Photos that already have GPS keep their own. Then, if you pick the Date-Time + Location naming template or a Year/Location folder layout, the place name appears in filenames and folders.

For photos that already have coordinates, the place name comes from reverse geocoding: OpenStreetMap on Windows and Linux, Apple's service on macOS. That lookup sends only the coordinates, never the photo, and only if you choose a template that needs place names. Everything else runs offline.

On macOS, Windows and Linux. Free for 500 photos, $9.99 one-time for unlimited.

Frequently asked questions

Does adding GPS change the picture?

No. EXIF is a separate block in the file. The image data is untouched. File size grows by a few dozen bytes.

Will Google Photos or Apple Photos pick up the location I add?

Yes, on import. Both read the GPS tags and place the photo on the map. If the photo is already in the library, you may need to re-import or, in Apple Photos, use its own location editor.

What if I only know the country?

Leave it out, or pick the capital and accept that the map pin is approximate. A country-level location is usually not worth having. The date matters more for sorting.

Can I add a location to videos too?

MP4 and MOV have a location field in their metadata that exiftool can write. Support in photo apps is less consistent than for photos. The app writes location for photos; for videos it keeps whatever location the file already has.