Nearest city

Where is the nearest town? And the nearest real city? For any point in the world: the closest place of any size, and the closest with 100,000 and a million people.

How to use it

  1. Press My location, type a place, or click the map.
  2. Read the nearest town, the nearest city over 100,000 people and the nearest over a million.
  3. Click a row in the table to fly to that place.

5 practical uses

  1. Find the nearest town from a remote spot for fuel, food or help.
  2. Name the closest city to a coordinate in a report or a log.
  3. Find the nearest big city to a small town for flights or trains.
  4. Check the nearest places to a property or a campsite.
  5. Locate a point by its nearest city in a message.

The maths behind it

The haversine great-circle distance from the point to the centre of every place in the data is computed, and a small heap keeps the nearest for each population threshold. A big city has only one centre point, so in its outer districts a smaller neighbour's centre can be nearer. To find the place you are in, each place also gets a circle that grows with its population (13 m × the square root of its population: about 12 km for Liverpool, 900 m for a town of 5,000). Of the circles that hold the point, the one the point is deepest inside is the place you are in. That place is always in the list, and for the city rows it comes before a nearer centre. The direction is the initial bearing to each place.

Notes

Cities and towns come from GeoNames (CC BY 4.0): every populated place with 5,000 or more people, 46,000 of them, with the population GeoNames records, which for a city is usually the municipality rather than the metropolitan area. Distances are to the centre point of each place.

Distances are straight lines. The nearest town by road can be a different one; see the driving distance for that.

Questions and answers

What counts as a city?

A populated place with 5,000 or more people in the GeoNames data. The two larger thresholds pick out real cities.

Is the distance by road?

No, straight line. The nearest by road can be a different place.

Does it work at sea or in the desert?

Yes. Click anywhere; the nearest places are found whatever the distance.

Embed this tool on your website

Paste this code where the tool should appear. It shows the tool alone, without this page's text, and links back here. It is free to use; the map data credit stays on the map.

<iframe src="https://waymorphic.com/tools/nearest-city?embed=1" width="100%" height="760" style="border:0;border-radius:12px;max-width:100%" loading="lazy" allow="geolocation; fullscreen; clipboard-write" title="Nearest city – Waymorphic Map"></iframe>

Change height to suit your page. To open the tool with a place already set, add the settings from this page's address bar (the part after #) to the end of the src. The embedded tool asks the visitor's browser for their location only when they press the button, and the allow attribute lets that work inside the frame.