Advertisement

Manhattan distance calculator

Use matching coordinate lists, or omit the last coordinate of B and enter a known Manhattan distance.

Calculator

Manhattan distance
7.00000000
Euclidean distance
5.00000000

Advertisement

How this calculator works

Manhattan distance adds the absolute change on each coordinate axis. It models an unobstructed axis-aligned grid route, rather than a diagonal shortcut. With a missing final coordinate, subtract the known axes from the total distance. The remaining absolute difference gives two positions, or one if it is zero. All coordinates must use compatible units and equally scaled axes.

Formula

d1(A,B) = sum |Ai-Bi|. If the last coordinate is missing, Bn = An plus or minus (d1 - sum of known absolute differences).

Worked example

From (0, 0) to (3, 4), Manhattan distance is 3 + 4 = 7, while Euclidean distance is 5. If A = (0, 0), Bx = 3 and distance is 7, By can be -4 or 4.

Advertisement

Frequently asked questions

Does this account for blocked streets?

No. Barriers, one-way streets and unequal travel costs require a routing model.

Can I use negative coordinates?

Yes. Absolute differences make the distance nonnegative regardless of the signs.

Can the answer be smaller than Euclidean distance?

With the same coordinates and scale, Manhattan distance is at least the Euclidean distance.

Sources

Advertisement