Simplify multidimensional list of points into track/linestring

I have a bunch of points representing the movement of a target:

``````Track_123 = [Point_1, Point_2, Point_3 ... Point_N]
``````

Where each point is a multidimensional vector:

``````Point_N = [Lat, Lon, Time, Speed, Bearing, ... Var_X]
``````

What I would like to do is to turn the list of points into a simplified track. This is sitting in a PostgreSQL/PostGIS database. I'd like to use something like ST_Simplify but that's limited to 2D or maybe 3D data. Should I do somekind of simplify in numpy and then store those as a linestring in PostgreSQL?

EDIT: What I'm hoping to achieve: So the points are not evenly distributed along the linestring and some don't add any meaningful extra information. I'm hoping to simplify the line but maintain the other info in the vector. I am leaning towards using some kind of spline to evenly space the positions and time (Lat, Lon, Time_x) and then do individual interpolation along the other vectors: interp(Time_x, Speed), interp(Time_x, Bearing) etc

• Could you give a bit more information about how you would simplify variables like time and bearing. The Peuker algorithm is well understood for lines/polygons, but it isn't obvious how you would extend this to non-spatial dimensions. Apr 10, 2017 at 12:00
• Edited to be a bit more clear. What I need in the end is a Track that takes up less space in the database but still represents the behaviour of the target along the trajectory.
– RedM
Apr 10, 2017 at 12:58
• I don't think that you can use splines directly in Postgres/Postgis, so I would suggest doing that part in numpy, as you have stated. Once you have a smoothed line, you could use ST_LineInterpolatePoint to calculate what you are looking for. However, it might be easier to do the whole thing in Python, as you would need to store lines created from the spline, and then interpolate, and the intermediate step could potentially take up even more space than the individual n-dimensional vectors do now. Apr 10, 2017 at 13:45