I use Python:
I have 2 arrays of GPS points - lon and lat (more than 500 000 points).
I have 1 array of date-time.
lon = numpy.array(lon)
lat = numpy.array(lat)
dt = numpy.array(dt)
I have a location error (GPS sensor error). For example 15 meters.
GPS_sensor_error = 0.015
I need to exclude a GPS_sensor_error from coordinates that there were no asterisks on a track.
(I don't draw a point with identical coordinates)
How I am able to do it?
Now:
I calculate distance between points.
I find the minimum distance, if it less GPS_sensor_error, then I average lon, lat.
repeat 1.
repeat 2.
repeat until all distances won't be more GPS_sensor_error
Update:
lon = numpy.array()
lat = numpy.array()
flag = True
while flag:
lon1 = lon[:-1]
lon2 = lon[1:]
lat1 = lat[:-1]
lat2 = lat[1:]
'''distance'''
x = (lon2 - lon1)
y = (lat2 - lat1)
d = numpy.sqrt(x * x + y * y)
min = numpy.min(d)
if min < GPS_sensor_error:
j = numpy.where(d == min)[0][0]
lon[j] = (lon[j] + lon[j + 1]) / 2
lat[j] = (lat[j] + lat[j + 1]) / 2
lon = numpy.delete(lon, j + 1)
lat = numpy.delete(lat, j + 1)
else:
flag = False
Bypass on all points works at a pure python very long... Prompt please, how to implement it using scipy, numpy?
Thanks
P.s. probably already there is a GPS filter in scipy, numpy?
average lon,lat
exactly in this context? – Theodros Zellekelon
andlat
are shrinking with each iteration:lon = numpy.delete(lon, j + 1); lat = numpy.delete(lat, j + 1)
. Now in a comment on @spam_eggs answer you explicitely state, that the sizes oflon
andlat
should be preserved???? – Theodros Zelleke