## 2017년 7월 18일 화요일

### GPS

I had a question in regards to GPS. I would like to make a mileage tracker. So if I use two GPS location and try to calculate the distance between them is it calculated in a straight line? Can someone maybe give me a link where I could find some more information about this. Or maybe someone already made an app like this that I could play around with.

--
at great distances you can use the method of Haversine, you can download an app of this Spanish tutorial

Defining Procedures: Reusing Blocks (Distance between points)

--
if I use two GPS location and try to calculate the distance between them is it calculated in a straight line?      Yes unless you use something like Google's Map API to provide the Navigation information.

You can calculate straight-line distance between two coordinates by use any one of several mathematical algorithms.  Which you use depends on how far apart
the geocoordinates actually are.  For distances of up to several miles, you might use the haversine method (there are some blocks in this post Finding distance between 2 coordinates - Haversine implementation ) .   You can use simple trig as some loss of precision or for large distances you can use spherical geometry.   These methods always will show the minimum distance traveled in the case you are attempting to find the distance using roads and streets.

You might look at an app called greatCircleDistance in the MIT Gallery apps.

--
Here is a simple way to do it if you prefer to use something simpler than the Haversine formula
--
or if you want to Navigate, try the suggestions here Navegador GPS .
To do this one of the points has to be provided by the LocationSensor in an Android and the second can be anywhere you want.  This method will give you the driven or walked path distance, NOT the straight-line distance.

--
The later was exactly what I was looking for Steve. Thank you Juan and Steve for your help.

--