0

I want to get distance of two cities having their latitude and longitude. Is there a java lib to do it? Apache common math seems to have a spherical class. Is there any one used it?

Anders Gustafsson
  • 15,837
  • 8
  • 56
  • 114
Behzad
  • 53
  • 1
  • 8
  • A pretty good estimate of the [great-circle distance](http://en.wikipedia.org/wiki/Great-circle_distance#Formulas) is simple. (The first formula works fine, even with distances a meter or two apart, when you're calculating with doubles. So you can largely ignore the precision warnings on that page.) I say "estimate" because the formulas don't account for the fact that the earth is a hair fatter than it is tall. – cHao Jul 29 '14 at 14:43

1 Answers1

1

Check out this answer: Calculating distance between two points, using latitude longitude, what am I doing wrong?

Doesn't utilize a library, but the accepted answer will solve your problem.

Community
  • 1
  • 1
Jeff
  • 406
  • 4
  • 5