I am attempting to build an elevation profile using PostGIS-PostgreSQL only.
I have imported GPX data in my PostGIS database, so now I have a table full of the GPS coordinates of the track and the timestamp of every single GPS point of the track. Now I would like to build a second table that contains, in a single row:
- the track id
- an array of floats representing the incremental distance from the starting point
- an array of floats representing the incremental time from the starting point
Is it possible to do it in a single SQL stored procedure?
Best Answer
Here's a start (not really tested...)
First two assumptions:
I made two test tables: tracks for the points and accum for the accumulated distances and times
and
Now here's a rough draft of a function that accumulates distances and times, and puts the values into arrays in the accum table. This function is called with the trk_id as a parameter.
Maybe that will help you get started.