Class: CartoDB::GPX
- Inherits:
-
Object
- Object
- CartoDB::GPX
- Defined in:
- lib/cartodb-importer/gpx.rb
Overview
class to get the point number in GPX files
Instance Method Summary collapse
- #_points_for(table) ⇒ Object
-
#initialize(filename) ⇒ GPX
constructor
A new instance of GPX.
- #route_points ⇒ Object
- #track_points ⇒ Object
Constructor Details
#initialize(filename) ⇒ GPX
Returns a new instance of GPX.
7 8 9 10 |
# File 'lib/cartodb-importer/gpx.rb', line 7 def initialize(filename) @filename = filename @ogr2ogr_bin_path = `which ogr2ogr`.strip end |
Instance Method Details
#_points_for(table) ⇒ Object
12 13 14 15 16 |
# File 'lib/cartodb-importer/gpx.rb', line 12 def _points_for(table) cmd = "#{@ogr2ogr_bin_path} -f CSV /vsistdout/ #{@filename} -sql 'select count(*) from #{table}'" #RUBY WAY `#{cmd}`.strip.split[1].to_i end |
#route_points ⇒ Object
22 23 24 |
# File 'lib/cartodb-importer/gpx.rb', line 22 def route_points _points_for('route_points') end |
#track_points ⇒ Object
18 19 20 |
# File 'lib/cartodb-importer/gpx.rb', line 18 def track_points _points_for('track_points') end |