Finding cities close to one another using longitude and latitude

Posted by Jamie on Stack Overflow See other posts from Stack Overflow or by Jamie
Published on 2011-01-11T19:47:21Z Indexed on 2011/01/12 15:54 UTC
Read the original article Hit count: 216

Each user in my db is associated to a city (with it's longitude and latitude)

How would I go about finding out which cities are close to one another?

i.e. in England, Cambridge is fairly close to London.

So If I have a user who lives in Cambridge. Users close to them would be users living in close surrounding cities, such as London, Hertford etc.

Any ideas how I could go about this? And also, how would I define what is close? i.e. in the UK close would be much closer than if it were in the US as the US is far more spread out.

Ideas and suggestions. Also, do you know any services that provide this sort of functionality?

Thanks

© Stack Overflow or respective owner

Related posts about php

Related posts about algorithm