# distance of two point (latitude and longitude) on earth to meters without using $\cos,\sin, \mathrm{harversine}$ formula, etc.

I'm getting the distance between two locations (lat/long) using Pythagoras theorem.

my data look like this (I use microdegrees because I have limitations)

point1: -34608420,-58373160
point2: -34609420,-58374160
distance:1414.213562373095

I have a few limitation, I'm building an application for a cell phone and using decimals and functions like $\sin, \cos$ are very expensive and take a lot of time. Also, I'm doing this calculation more than $1000$ times.

Pythagoras works fine, but I need to convert the result distance to meters. The radius is the Earth's radius.

I do not care about precession because the points are very close too each other and the arc would not be much.

So,

How can I convert the resulting distance using Pythagoras to meters? Is there a better way to do it, than using Pythagoras?

Thanks, Federico

-
Can you use taylor approximations to sin and cos? I don't think polynomials cost a lot of time now do they? –  Patrick Da Silva Jan 6 '12 at 22:12
There are pretty much 3 algorithms to simulate the trig functions: CORDIC, taylor series, and table lookup. Choice depends on your exact constraints. If you're processor constrained but the processor is better than a microcontroller, which I assume is the case for a cell phone, table lookup might be fastest. –  Mark Beadles Jan 7 '12 at 0:44

For small distances, the north/south distance is $R(\lambda_2-\lambda_1)$, where $R$ is the radius of the earth and $\lambda$ is latitude. The east/west distance is $R\cos \lambda (\phi_2-\phi_1)$ where $\phi$ is longitude. You can then use Pythagoras on these linear dimensions. The only problem is the $\cos \lambda$, which you can't get away from because the lines of longitude get closer as you get to the poles. You could store a table of cosines, maybe every $5$ degrees, and interpolate, to save the time.