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

Ruben L. Mendoza notifications at github.com
Thu Sep 17 20:48:29 UTC 2026


@Rub21 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])

Done, the SQL is a plain string now and the trace id goes in a bind array 

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

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


More information about the rails-dev mailing list