[openstreetmap/openstreetmap-website] Add a gpx_tracks table and convert trace points into linestrings (PR #7348)

Tom Hughes notifications at github.com
Tue Sep 15 18:08:25 UTC 2026


@tomhughes commented on this pull request.



> +  # Converts the points of a trace into linestrings, one per segment of
+  # max_points_per_track_segment points. Z is the altitude and M is the time in seconds.
+  #
+  # A track with one point is saved as a point, because a line needs two.
+  # All traces are converted, whatever their visibility.
+  #
+  # The job can run again for the same trace (a retry or a re-import). The delete
+  # and the insert run in one transaction, so the trace is left with only its
+  # current points.
+  #
+  # Segments do not share the border point. To draw a full track, join them in order
+  # by trackid and segment.
+  #
+  # Returns the number of segments written.
+  def perform(trace)
+    sql = ApplicationRecord.sanitize_sql_array([<<~SQL.squish, trace.id])

Why do we need to substitute the ID in here? Can we not just have the SQL as a string and then pass a bind array when doing the exec?

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/7348#pullrequestreview-5213979727
You are receiving this because you are subscribed to this thread.

Message ID: <openstreetmap/openstreetmap-website/pull/7348/review/5213979727 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20260915/e0f94c78/attachment.htm>


More information about the rails-dev mailing list