Class: Warpaint::GPX

Inherits:
Parser show all
Defined in:
lib/warpaint/gpx.rb

Instance Method Summary collapse

Methods inherited from Parser

#initialize

Constructor Details

This class inherits a constructor from Warpaint::Parser

Instance Method Details

#parse_into(struct) ⇒ Object



7
8
9
10
11
12
13
14
15
# File 'lib/warpaint/gpx.rb', line 7

def parse_into(struct)
  File.open(@input_file) do |f|
    doc = Nokogiri::XML(f)

    doc.xpath("//xmlns:trkpt").each do |trkpt|
      struct.add_track_point(:time => Time.parse(trkpt.child.content), :lat => trkpt["lat"], :lon => trkpt["lon"])
    end
  end
end