Sha256: 840ed96a9c16516ed2aa619d8b17153a882abd7d6096be74b4d9e6ab5edc0f51

Contents?: true

Size: 525 Bytes

Versions: 1

Compression:

Stored size: 525 Bytes

Contents


module CartoDB
  # class to get the point number in GPX files
  class GPX

    def initialize(filename) 
      @filename = filename
      @ogr2ogr_bin_path = `which ogr2ogr`.strip
    end

    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

    def track_points
      _points_for('track_points')
    end

    def route_points
      _points_for('route_points')
    end

  end
end
  

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cartodb-importer-0.2.19 lib/cartodb-importer/gpx.rb