In Postgres 9.1+ database contains route points:
create table doksyndm (
id serial primary key,
readingtime timestamp with time zone not null,
latitude float,
longitude float
);
Points are saved from browser using navigator.geolocation calls from javascript.
How to calculate route lenght from this data ? Route is less than 300 km so direct line lenghts between points can summed. It should work in Postgres 9.1 and newer.
Result shoud be one number, total distance between points in kilometers. Database and javascript code sending points can re-factored if this is reasonable.
Answers in Calculate distance between two points in google maps V3 how to implemtn this in produral languages.
They use for loop which is not available in SQL. Maby SUM() with window function can used to implement this ?