I have coordinate data(lat,long) of various vehicles travelling from similar source to similar destination.
There are some cases when these vehicles do not follow the regular path while going from source to destination. I am trying to find those coordinate sets where there is change from standard path.
I have latitude, longitude and time. I have to analyse the changes in path and detect the position of path change as well. I have large set of data, so i am trying to find an optimal way of doing this.
I know a bit about hausdorff distance and Jackardd Similarity. But i am trying to get more efficient way, since my data set is near to 1TB. Also, if there is any easy way to do this with PostGis. Please suggest.
For specified data amount, I'm afraid, QGIS wouldn't be a proper option. If you decide to go with PostGIS, you must bear in mind GPS accuracy of your source data. I mean, even if you go exactly the same route two times you're not necessarily getting two identical footprints.
However, the very first thing I would consider upon uploading your data into PostGIS, is simplifying (st_simplify()
) it to get rid of vertices that are not essential and thus to boost further calculations speed.
Next, I would employ st_buffer()
to wrap routes into buffers to tolerate GPS data deviation within some acceptable range.
After that, with combination of st_intersection()
and st_area()
I would measure the likeliness of two routes based on the common area of two buffers.
The very basic query
select st_area(st_intersection(st_buffer(r1.geom,0.001),st_buffer(r2.geom, 0.001)))/st_area(st_buffer(r1.geom, 0.001)) as "blue2red",
st_area(st_intersection(st_buffer(r1.geom,0.001),st_buffer(r3.geom, 0.001)))/st_area(st_buffer(r1.geom, 0.001)) as "yellow2red",
st_area(st_intersection(st_buffer(r2.geom,0.001),st_buffer(r3.geom, 0.001)))/st_area(st_buffer(r2.geom, 0.001)) as "blue2yellow"
from route r1
join route r2
on r2.name='blue'
join route r3
on r3.name='yellow'
where r1.name='red'
returns
blue2red yellow2red blue2yellow
0.495408079 0.641252527 0.688753036
I guess, that looks like something to start with.