Dear R users,


subject:  How to filter XY pairs of inacurate gps position along track, taking into account the time index to not mix track from different days in one average track


or subject as: How to filter XY pairs of inacurate gps position: (latitude, longtitude)
to get estimated correct position before calculating track

i.e.

How to estimate (time series? )?  
How to filter XY pairs of inacurate gps position along track: 
Lon<-c(18.13015167,18.13022667,18.13028500,18.13035500,18.13041333,18.13047000,18.13054667,18.13060333,18.13067500,18.13073167,18.13079000,18.13085167,18.13091000,18.13096667,18.13103000,18.13109500,18.13114500,18.13120167,18.13124667,18.13130500,18.13136167,18.13140667,18.13146333,18.13150833,18.13156500,18.13161000,18.13167167,18.13171667,18.13177000,18.13181333,18.13187167,18.13191667,18.13197333,18.13203167,18.13208833,18.13214667,18.13220333,18.13225333,18.13231000,18.13236833,18.13243000,18.13249167,18.13254167,18.13259833,18.13265667,18.13270500,18.13276333,18.13282000,18.13287000,18.13292667,18.13298500,18.13304667,18.13310500,18.13315333,18.13321500,18.13327833,18.13332667)
Lat<-c(48.95961500,48.95961667,48.95961500,48.95961000,48.95960667,48.95959833,48.95960167,48.95959833,48.95959333,48.95959167,48.95959000,48.95959333,48.95959167,48.95958833,48.95959333,48.95958167,48.95958833,48.95958500,48.95958500,48.95958333,48.95958000,48.95957500,48.95957167,48.95957167,48.95956500,48.95955833,48.95956833,48.95956833,48.95955833,48.95955333,48.95955167,48.95955000,48.95954333,48.95954000,48.95953833,48.95953500,48.95953333,48.95954000,48.95953667,48.95954000,48.95954500,48.95954833,48.95955500,48.95955833,48.95955667,48.95956167,48.95956000,48.95955833,48.95957000,48.95956667,48.95956000,48.95956333,48.95956167,48.95956833,48.95957167,48.95958167,48.95958833)
t_index<-1:(length(Lat))

Raw<-as.data.frame(cbind(t_index,Lon,Lat))
colnames(Raw)<-c('t_index','Lon','Lat')


plot(Raw$Lon,Raw$Lat,type="l",main = "lowess(cars)")
# data should be or filtared or ...?
#expected answer:
# ver 1 ------------------------------------------------------------------------------
    #Raw$Lon_v2<- f_x (x=Raw$Lon, y=Raw$Lat)
    #Raw$Lat_v2 <- f_y (x=Raw$Lon, y=Raw$Lat)
    #lines(Raw$Lon_v2,Raw$Lat_v2,col=2)


# ver 2 ------------------------------------------------------------------------------
op <- par(mfrow = c(2,1), mgp = c(2,.8,0), mar = .1+c(3,3,3,1))
    plot(Raw$Lon,Raw$Lat,type="l",main = "lowess()")
    f_k2=0.3
    Raw$Lon_v2<-(lowess(x=Raw$Lon, y=Raw$Lat,f=f_k2))$x
    Raw$Lat_v2<-(lowess(x=Raw$Lon, y=Raw$Lat,f=f_k2))$y
    points(Raw$Lon_v2,Raw$Lat_v2,col=2,pch='+')
    lines(Raw$Lon_v2,Raw$Lat_v2,col=2)
     f_k3=0.6
     Raw$Lon_v2<-(lowess(x=Raw$Lon, y=Raw$Lat,f=f_k3))$x
     Raw$Lat_v2<-(lowess(x=Raw$Lon, y=Raw$Lat,f=f_k3))$y
     points(Raw$Lon_v2,Raw$Lat_v2,col=3,pch='x')
     lines(Raw$Lon_v2,Raw$Lat_v2,col=3,lwd=2)
     legend(Raw$Lon_v2[1],Raw$Lat_v2[1], c(paste("f = ", c(round(f_k2,2),round(f_k3,2)))), lty = 1, col = 2:3)

par(op)

How to approximate these positions along some possible track (line, curve)
for all localizations along the track, that can change directions.

The above methods are not good, because, if there are many track in vincinity of the first track, the above method 

will average the points between track, that are close each another.

And we need to aproximate only along one time track,

i.e. the car (Lat Lon position) in one moment must be laid along one route (lane) (today's track) 

and not along the route that it will cover 2 days ago, only because that is another day, the another index of point.   

Yours sincerely,
Eugen


 

	[[alternative HTML version deleted]]

