1

How do you convert degrees (longitude latitude) to miles in Java?

For example if I want to move longitude by 69.11 miles, I add 1 degree. Do I do simple calculation or should I use some kind of API.

MatBanik
  • 26,356
  • 39
  • 116
  • 178
  • A couple clarification questions. First, I'll assume from your question that you're interested in air mileage - if you need road mileage, the answer is different, and much more interesting. What level of accuracy do you need? How important is efficient computation? Some simplifying assumptions can speed computation at the expense of accuracy (for example, assuming - incorrectly - that the earth is spherical simplifies computation considerably). – AaronD Apr 25 '11 at 16:25
  • Duplicate question : **[Working with latitude/longitude values in Java](http://stackoverflow.com/questions/120283/working-with-latitude-longitude-values-in-java)** – lschin Apr 26 '11 at 02:04

1 Answers1

1

From http://www.meridianworlddata.com/Distance-Calculation.asp:

Improved approximate distance in miles:

    sqrt(x * x + y * y)

where x = 69.1 * (lat2 - lat1)
and y = 69.1 * (lon2 - lon1) * cos(lat1/57.3) 

There were a few other good sites on the google.

corsiKa
  • 81,495
  • 25
  • 153
  • 204