Distance between cities
Measure the straight-line distance between two city centers.
A state after the comma picks the right one: Portland, ME.
Use it in your app
GET /city/Portland?state=OR
One /city call per side finds each city's reference coordinates, and the distance is computed between them. Check the city names and regions in the result. Same endpoint on every plan, one pooled request per lookup.
QUESTIONS
- How is the distance measured?
- A straight line between the two city center points, the great-circle math airlines use. Driving distance follows roads and runs longer.
- It picked the wrong Portland.
- A city name can match more than one place. Add a state after a comma, such as Portland, ME, and check the city and region shown in each result.
- Which cities are covered?
- The tool uses the City API's current coverage. A name that cannot be resolved returns no result. Check the returned region when a name exists in more than one place.
- Can I do this from code?
- Yes. GET /city/{name} returns a city's reference coordinates. Look up each city and calculate their straight-line distance. One pooled request per city lookup.