Your Mac asks Apple Maps a simple question, such as "what is at these coordinates?" or "where is Vienna?", and gets a place name or a point on the map in return. The only things that leave your Mac are the coordinates, or the city and country, and nothing else about the photo goes with them.

A request is just a pair of coordinates, or a city and country. It has no picture, no file name, no date and no name attached. Apple Maps answers a question about a place, and has no idea there is a photo behind it.

It is the same lookup that lets Maps name a spot you tap, built into every Mac and iPhone, so Raza Photos doesn't need an atlas, an account or a service of its own.

Two tools, one idea

Both are in the Library menu on the Mac, and both work on the photos you have selected.


What goes out, what comes back

Looking up a place is a lookup in a very large table of the world's places, searched by position or by name. The table is too big to ship inside an app, which is why this one step asks Apple Maps. Here is the whole exchange, in both directions.

Tool Goes out Comes back Saved to the file as
Fix Location from GPS Latitude and longitude, rounded to three decimals Country and city IPTC Country and City, XMP LocationCreated (CountryName, City), ACDSee place categories
Add GPS from Location The text "City, Country" Latitude and longitude of the city's center EXIF GPS latitude and longitude, with N/S and E/W references

That is the full list. Everything else about a photo, its pixels, file name, date, title, people and albums, takes no part in the exchange. The lookup runs on the coordinates, and works exactly the same whether they came from a holiday photo or a number you typed in.


Rounding to about 100 meters

Before anything is asked, coordinates are rounded to three decimal places. That is a little blurrier than your GPS fix, and more than enough to name a city. It also makes the work smaller, and the maths is pleasant.

One degree of latitude is about 111 kilometers on the ground, everywhere on Earth. Three decimal places is a thousandth of a degree, so each step is about 111 meters north to south. East to west the ground shrinks as you move away from the equator, by a factor of the cosine of the latitude. In Vienna, at 48° north, a thousandth of a degree of longitude is about 74 meters.

So 48.20849, 16.37208 and 48.20853, 16.37211, two photos taken a few steps apart, both round to 48.208, 16.372 and share one question. That is how a hundred photos from one beach turn into a single lookup.


How a place name is found

This is Fix Location from GPS, step by step.

Photos without GPS coordinates are skipped, and the dialog tells you how many. Raza Photos shows the rest on a map so you can see what you're about to fix.

Photos that round to the same spot (see above) are grouped, so a big selection goes quickly: a hundred photos from one beach need one lookup.

For each spot it returns a country and a city. If it has nothing to say about a spot, such as open sea or somewhere remote, those photos are left exactly as they were.

The country and city are stored in your library and written into the photo's file, as open metadata other apps can read. Nothing else about the file changes. What gets written →


How coordinates are found

Add GPS from Location works the other way around. For each different city and country in your selection, Raza Photos asks Apple Maps where it is, and places the photos there. The result is an approximate position at the city's center, not the exact spot where the photo was taken. It is enough to put a photo on the map and in the right city, and a real GPS reading, or a pin you place yourself, is always better.

Before it starts, Raza Photos tells you how many photos will be placed, and how many already have coordinates that would be replaced. You confirm, or you don't.


What you need

  • An internet connection while the tool runs. Apart from the map tiles, everything else in Raza Photos works at home with the router off.
  • A Mac. The two tools are in the Mac's Library menu, and photos fixed there show up on your iPhone and iPad like any other change.
  • Nothing else: no account, no key and no extra app.
On iPhone and iPad, picking a spot on the map for a photo uses the same lookup to name the place. You see the pin you picked, so there is no mystery about where the name comes from.

Place names come from MapKit's MKReverseGeocodingRequest, and coordinates from MKGeocodingRequest. A result needs both a country and a city to be used. If either is missing, the photo is left untouched.

Before any request, coordinates are rounded to three decimal places (about 111 meters of latitude) and used as a cache key, so each distinct spot is looked up once per run. The forward direction groups photos by their city and country the same way, so each place is asked about once.

When a result comes back, the country and city are written to the library database and to the photo file in one step, in the IPTC Country/PrimaryLocationName and City fields, as an Iptc4xmpExt:LocationCreated structure in XMP, and as ACDSee place categories. Coordinates found from a city name are written to the EXIF GPS dictionary as absolute values with N/S and E/W reference letters.