Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 35119
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T14:11:09+00:00 2026-05-10T14:11:09+00:00

How do you calculate the distance between 2 cities?

  • 0

How do you calculate the distance between 2 cities?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T14:11:09+00:00Added an answer on May 10, 2026 at 2:11 pm

    If you need to take the curvature of the earth into account, the Great-Circle distance is what you’re looking for. The Wikipedia article probably does a better job of explaining how the formula works than me, and there’s also this aviation formulary page that covers that goes into more detail.

    The formulas are only the first part of the puzzle though, if you need to make this work for arbitrary cities, you’ll need a location database to get the lat/long from. Luckily you can get this for free from Geonames.org, although there are commercial db’s available (ask google). So, in general, look up the two cities you want, get the lat/long co-orinates and plug them into the formula as in the Wikipedia Worked Example.

    Other suggestions:

    • For a full commercial solution, there’s PC Miler which is used by many trucking companies to calculate shipping rates.
    • Make calls to the Google Maps (or other) api. If you need to do many requests per day, consider caching the results on the server.
    • Also very important is to consider building an equivalence database for cities, suburbs, towns etc. if you think you’ll ever need to group your data. This gets really complicated though, and you may not find a one-size-fits-all solution for your problem.

    Last but not least, Joel wrote an article about this problem a while back, so here you go: New Feature: Job Search

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The code below is used to calculate the miles between two cities. In this
How do I calculate distance between two GPS coordinates (using latitude and longitude)?
How to Calculate distance between two place using latitude-longitude in gmap for iPhone?
What is the best way to calculate the distance between two points/Or we can
I read various stuff on this and understand the principle and concepts involved, however,
Problem: I have a large collection of points. Each of these points has a
Possible Duplicate: Working with latitude/longitude values in Java Duplicate: Working with latitude/longitude values in
I'm used to Atlas where the preferred (from what I know) method is to
I am reverse engineering a transportation visualization app. I need to find out the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.