Alex Rivera | Logout

Calculating Distance Between 2 Cities

Asked 2008-08-22T21:39:41.917
16

How do you calculate the distance between 2 cities?

Edit
Report

2 Answers

0

I've been doing a lot of work with this recently. I'm finding SQL2008's new features really make this easy. I can find all the points that are withing Xkm of a 100k record table in sub-second time...not too shabby.

The great circle (spherical assumption) method in my testing was about 2.5 miles off when compared to the vincenty formula (elipsoidal assumption, which is what the earth is).

The real trick is getting the lat and long..for that I'm using Google.

answered 2008-08-22T23:23:35.910
0

@Jared - a minor correction to your code example. The last line of the first code example should read:

dist = sqrt(dx*dx + dy*dy);
answered 2008-08-22T23:44:18.340

Your Answer