Distance matrix

A table of the distances between every pair of places in a list, as the crow flies or by road with the driving time. Copy it as CSV for a spreadsheet.

How to use it

  1. Add up to twelve places: search, use your location, or click the map.
  2. Choose straight line or a road mode. Switch between distance and time with the chips.
  3. Read the table: rows are the origin, columns the destination.
  4. Press Copy CSV to paste the table into a spreadsheet.

5 practical uses

  1. Build a distance table for a tender, a logistics plan or a spreadsheet model.
  2. Compare candidate warehouse sites by their distance to every customer.
  3. Pick a meeting venue that is fair for every office.
  4. Feed a routing or scheduling tool with the distances it needs.
  5. Check which of several suppliers is nearest to each site.

The maths behind it

The straight-line matrix is the haversine great-circle distance for each pair, n² values. The road matrix comes from the engine's sources-to-targets service, which runs one shortest-path search from each origin over the road graph and reads off the cost to every destination, so it is asymmetric where one-way roads make it so.

Notes

A road matrix is not symmetric: one-way streets and motorway junctions make A to B differ from B to A. A straight-line matrix is. A blank cell means the engine found no road route between the two.

Routes come from Valhalla, an open routing engine on OpenStreetMap data run by FOSSGIS, the German OpenStreetMap association. It is a public, best-effort service: it can be slow at busy times, and a route through a badly mapped area is only as good as the map. Nothing else about you is sent with the request.

Questions and answers

Why is the road table not symmetric?

One-way streets, motorway junctions and turn restrictions make the route from A to B differ from B to A. The straight-line table is symmetric.

What does a blank cell mean?

The engine found no road route between the two places, for instance across the sea.

What unit is the CSV in?

The unit selected at the top of the page, kilometres or miles, or minutes when the table shows times.

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/distance-matrix?embed=1" width="100%" height="760" style="border:0;border-radius:12px;max-width:100%" loading="lazy" allow="geolocation; fullscreen; clipboard-write" title="Distance matrix – 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.