Imagine a GPS tracking system that is following the position of several objects. The points are stored in a database (PostgreSQL + PostGIS).
Each path is composed by a different number of points. That is the reason why, in order to compare a pair of paths (compare the whole path), I want to divide every path in a set of 100 points. This is the problem. Do you know any PostGIS function that already implement this algorithm? I've not been able to find it.
If not, I'd like to solve it using Java. In this case I'd like to know an efficient and easy to implement algorithm to divide a path into N points.
The most simple example could be to divide this four-points-path into eight points:
position 1 : x=1, y=2
position 2 : x=2, y=4
position 3 : x=3, y=6
position 4 : x=4, y=8
And the result should be:
position 1 : x=1, y=2 (starting point)
position 2 : x=1.5, y=3
position 2 : x=2, y=4
position 2 : x=2.5, y=5
position 2 : x=3, y=6
position 2 : x=3.5, y=7
position 2 : x=4, y=8 (ending point)
Edit: By 'compare a pair of paths' I mean to calculate the distance between two complete paths. I plan to divide each path in 100 points, and sum the euclidean distance between each one of these points as the distance between the two paths.