Reduce GPS data set by distance

I have a set of GPS coordinates, created by a GPS sensor and a Raspberry Pi. I am poling the sensor at 10hz and recording the data into an SQL DB on the Pi. The system is on top of my car (and part of a house scanning tool for the building industry). The issue is that I am driving at different speeds. In some instances I have to stop to allow other cars to pass, all the while record GPS location at 10hz.

Once the data is recorded I want to post-process the GPS data and output a reduced list of coordinates so that I have locations approximately 1 metre apart.

I know I can maybe use Pandas for this, but have no idea where to start.

This is an example data set:


Any help will be very much appreciated.


I worked a solution based on finding the distance suggested by @Ferris. The ‘mpu.haversine_distance’ function returns a distance in KM’d between two lat/lng pairs. I multiply by 1000 to display as metres. I then add these distances up and if it gets over 1 metre I report back that lat/lng. This can be adjusted to 3 metres etc.

import mpu

def processTheSet(batch):
    mycursorll = mydb.cursor()
    sqlll = "SELECT latt, longg FROM interPol WHERE batchID = %s ORDER BY `fileTime`"
    batchI = (batch,)
    mycursorll.execute(sqlll, batchI)
    firstResult = mycursorll.fetchone()
    firstLat = float(firstResult[0])
    firstLng = float(firstResult[1])
    myresultll = mycursorll.fetchall()
    i = 0
    count = 0
    counter = 0
    dist = 0
    for x in myresultll:
        i = i + 1
        thisLat = float(x[0])
        thisLong = float(x[1])
        dist = mpu.haversine_distance((firstLat, firstLng), (thisLat, thisLong)) * 1000
        firstLat = thisLat
        firstLng = thisLong
        counter = counter + dist
        if counter > 1:
            count = count + 1
            counter = 0
            print(thisLong, ",", thisLat)