If I have the co-ordinates of two zip codes in Degrees Latitude and Longitude, how do I calculate the distance in nautical miles, or kilometers? The answer to this question depends on how accurate you need it to be. As a matter of fact, the Earth is technically roughly ellipsoidal (or more precisely, oblate spheroidal) […]
Read More...
If I have the co-ordinates of two zip codes in Degrees Latitude and Longitude, how do I calculate the distance in nautical miles, or kilometers? The answer to this question depends on how accurate you need it to be. As a matter of fact, the Earth is technically roughly ellipsoidal (or more precisely, oblate spheroidal) with a radius varying between about 6,378km (equatorial) and 6,357km (polar), and local radius of curvature varying from 6,336km (equatorial meridian) to 6,399km (polar).
So if you need pinpoint accuracy, it is best to look at an algorithm with uses an ellipsoid, such as Vincenty's algorithm, which is accurate to the mm. Although, these sort of algorithms deal with pretty complicated formulas and require serious computing power, which can considerably load your hardware or even bring your server to its knees if it comes to hundreds requests a second.
At the same time, most commercial applications, like zip code distance calculator, normally do not require that space shuttle style accuracy. If you are looking for a good barbecue restaurant within 10 miles of your office for a friendy meet up, you would not mind to drive extra 10 yards. Therefore, we can easily opt to a much simpler algorithm and solve this problem by using spherical coordinates on the earth. Have you the reader dealt with those before? Luckily, it is not as difficult as you might imagine.
The good news also are that while assuming that the Earth is a perfect sphere, it greatly increasing computing performance of a zip code distance calculator software. Moreover, the accuracy of this method is pretty high for a commercial application. The errors from assuming spherical geometry might be up to 0.55% crossing the equator, though generally below 0.3%, depending on latitude and direction of travel. The 0.3% accuracy means 3m in 1km - is it a problem for an average Joe riding a truck to get some BBQ fun?
So for a fast and accurate enough zip code distance calculator would take advantage of assuming that the Earth is a perfect sphere. This means using simpler math functions that provide the approximate distance calculation with sufficient accuracy and with much less complexity. We will not define the exact formulas in this article, the interested reader can easily find tons of information on mathematical sites on the net, from my side I highly recommend Mr.Math questions and answers website.
And finally, there is even faster algorithm to calculate distance between two places on Earth. An assumption that the Earth is flat leads to very simple (and quick to be calculated) math functions, even without that trigonometric math functions. One can easily to choose this way of developing a zip code distance calculator, and the author of this article has nothing against it. Although be warned that this method works for short distances only producing errors of 10% and more, and longer is the distance the higher is the error. Anyway, to calculate a distance from your school to the nearest pizza this method will work just fine.
So if you need pinpoint accuracy, it is best to look at an algorithm with uses an ellipsoid, such as Vincenty's algorithm, which is accurate to the mm. Although, these sort of algorithms deal with pretty complicated formulas and require serious computing power, which can considerably load your hardware or even bring your server to its knees if it comes to hundreds requests a second.
At the same time, most commercial applications, like zip code distance calculator, normally do not require that space shuttle style accuracy. If you are looking for a good barbecue restaurant within 10 miles of your office for a friendy meet up, you would not mind to drive extra 10 yards. Therefore, we can easily opt to a much simpler algorithm and solve this problem by using spherical coordinates on the earth. Have you the reader dealt with those before? Luckily, it is not as difficult as you might imagine.
The good news also are that while assuming that the Earth is a perfect sphere, it greatly increasing computing performance of a zip code distance calculator software. Moreover, the accuracy of this method is pretty high for a commercial application. The errors from assuming spherical geometry might be up to 0.55% crossing the equator, though generally below 0.3%, depending on latitude and direction of travel. The 0.3% accuracy means 3m in 1km - is it a problem for an average Joe riding a truck to get some BBQ fun?
So for a fast and accurate enough zip code distance calculator would take advantage of assuming that the Earth is a perfect sphere. This means using simpler math functions that provide the approximate distance calculation with sufficient accuracy and with much less complexity. We will not define the exact formulas in this article, the interested reader can easily find tons of information on mathematical sites on the net, from my side I highly recommend Mr.Math questions and answers website.
And finally, there is even faster algorithm to calculate distance between two places on Earth. An assumption that the Earth is flat leads to very simple (and quick to be calculated) math functions, even without that trigonometric math functions. One can easily to choose this way of developing a zip code distance calculator, and the author of this article has nothing against it. Although be warned that this method works for short distances only producing errors of 10% and more, and longer is the distance the higher is the error. Anyway, to calculate a distance from your school to the nearest pizza this method will work just fine.
Related Posts
-
Turn Your Scrap Gold Into Money
A highly valuable and precious metal, Gold has a lot of utilities other than
-
Cash For Gold
Do you have what it takes to transform carats into liquid assets? Gold dealers
-
Scrap Gold Buyers – An Overview
With the global financial crisis hovering over, people are looking for many ways to
-
Get The Best Price For Your Scrap Gold
The price of gold goes up when the demand for it is high. You
-
What is Scrap Gold? How To Fruitfully Market This Material
Most people are not conscious that one of the most engrossing areas of bullion
-
How to sell Scrap Gold to get the maximum benefit?
Gold is a precious metal and getting tremendous importance from ancient time. Gold purchase
-
Scrap Gold Buyers – An Overview
With the global financial crisis hovering over, people are looking for many ways to
-
Portland Gold Buyers Commodity
To sell gold to Portland gold buyers a person must understand how the system