]> git.openstreetmap.org Git - rails.git/commitdiff
Store latitudes and longitudes during gpx parsing
authorAnton Khorev <tony29@yandex.ru>
Mon, 23 Sep 2024 12:56:53 +0000 (15:56 +0300)
committerAnton Khorev <tony29@yandex.ru>
Wed, 25 Sep 2024 21:28:39 +0000 (00:28 +0300)
lib/gpx.rb

index 1bf7764ec5e3052f878c394f4ae75f9e1c9e879c..bae975b61a91d9d49190abac1d9c6ca842158681 100644 (file)
@@ -31,6 +31,8 @@ module GPX
             point.altitude ||= 0
             yield point
             @actual_points += 1
             point.altitude ||= 0
             yield point
             @actual_points += 1
+            @lats << point.latitude
+            @lons << point.longitude
           elsif reader.name == "trkseg"
             @tracksegs += 1
           end
           elsif reader.name == "trkseg"
             @tracksegs += 1
           end
@@ -44,6 +46,8 @@ module GPX
       @possible_points = 0
       @actual_points = 0
       @tracksegs = 0
       @possible_points = 0
       @actual_points = 0
       @tracksegs = 0
+      @lats = []
+      @lons = []
 
       begin
         Archive::Reader.open_filename(@file).each_entry_with_data do |entry, data|
 
       begin
         Archive::Reader.open_filename(@file).each_entry_with_data do |entry, data|