I am working on tracking system that track location of vehicles on the map and tell their total distance from the beginning till today.
I have device_id, timestamp and GPS location in the table like this:
Now I need to calculate progressive road distance between GPS coordinates and save into 4th column called dist. Also, I think if its better to calculate distance right when we receive new GPS location and compare it with previous location and save the calculated distance into dist column.
I am quite newbie in PostgreSQL. I am not sure which approach should I follow either earthdistance point-based or ST_Distance or is there something more appropriate that can fulfill my requirement?
Thank you in advance.
أكثر...
I have device_id, timestamp and GPS location in the table like this:

Now I need to calculate progressive road distance between GPS coordinates and save into 4th column called dist. Also, I think if its better to calculate distance right when we receive new GPS location and compare it with previous location and save the calculated distance into dist column.
I am quite newbie in PostgreSQL. I am not sure which approach should I follow either earthdistance point-based or ST_Distance or is there something more appropriate that can fulfill my requirement?
Thank you in advance.
أكثر...