Add a gpx_tracks table and convert trace points into linestrings - #7348
Add a gpx_tracks table and convert trace points into linestrings#7348Rub21 wants to merge 4 commits into
Conversation
|
I wrote a bash script to convert the old traces: it runs It splits the traces into ranges of ids and runs a few rake processes at the same time. It shows the plan and asks for a yes before it starts. status reads the logs and shows the percentage, the segments written and the errors. Traces that already have rows are skipped. Note: the bash script is only a proposal to run the conversion, if there is another way you normally do migrations, I can take a look at it. |
pablobm
left a comment
There was a problem hiding this comment.
Are we ok with losing the points without timestamp? Has this been discussed?
Incidentally, I realised that the Gpx module doesn't have tests, and we don't have any fixtures for files with more than one <trkpt>. Not for this PR, but we should add something.
We don't allow points without timestamps, and never have done. They fail the validity check at: openstreetmap-website/lib/gpx.rb Lines 175 to 179 in 26ba84e and also the model validations: openstreetmap-website/app/models/trace.rb Line 54 in 26ba84e |
|
I believe so because it was always a point of contention with some people wanting to remove them before uploading for "privacy" reasons. |
Ref: #7339
This PR adds a gpx_tracks table that stores the geometry of each trace. We use geometry(GeometryZM, 4326), where Z is the altitude and M is the timestamp.
The table is filled in two ways:
A rake task (
rake db:gpx_tracks) converts the traces that already exist. It runs on its own and has to be started by hand. It skips the traces that already have rows, and a trace is written completely or not at all, so the task can stop and start again without leaving half traces.When a user uploads a new trace during the migration, a job converts it and saves it in gpx_tracks too, so new traces do not need the migration.
Nothing reads this table yet. The job only writes to it, so the API, the trace pages and the tiles work the same as before. The goal is to have all gps_points as linestrings in gpx_tracks, so the migration away from gps_points can later be done on top of this table.
What this PR does: