I am trying to find distance between two points and to check whether distance is increasing or decreasing. One gps location is fixed and other is changing constantly. Only way to check is to find distance between them and comparing with previously mesaured distance. How to write code for this, I have used tiny GPS library for finding GPS location

I googled it for you

I am trying to find distance between two gps locations and check if distance between them is increasing or decreasing. One location is fixed and other is changing constantly. I have used tiny GPS for gps locations. How to check whether the distance is increasing or decreasing between 2 points.

tusharchatur01:

I have used tiny GPS library for finding GPS location

Look in the examples folder for the TinyGPS library, it has the code for that calculation.

(deleted)

Use math.

Go google Great Circle.

It lets you calculate the distance 'as the crow flys' between 2 points.

Save that distance.

then when you get your next GPS data, calculate the distance again.

If that distance is larger than your first distance, your distance is increasing.

If that distance is less, decreasing.

You might want to put in some logic to account for the variability of a GPS location reading. When you are sitting perfectly still, the GPS readings might deviate by many feet.

How far apart are the points, and by what amount does the distance change?

What is the required accuracy of that distance measurement?

There is a `distance_between`

function in TinyGPS.

NeoGPS also has distance functions, and they are more accurate than all other libraries, especially at small distances. NeoGPS is smaller, faster, more accurate and more reliable, and the example programs are structured better. You should try the NMEAdistance example. It calculates the distance between two points like this:

```
void loop()
{
while (gps.available( gpsPort )) {
gps_fix fix = gps.read(); // save the latest
// When we have a location, calculate how far away we are from the base location.
if (fix.valid.location) {
float range = fix.location.DistanceMiles( base );
```

You will have to remember the previous range for comparison.

NeoGPS is available from the Arduino IDE Library Manager, under the menu **Sketch -> Include Library -> Manage Libraries**. Even if you don't use it, there are many tips and suggestions on the Installation and Troubleshooting pages.

@tusharchatur01, do not cross-post. Threads merged.