class Geotagger::Geotagger
Attributes
options[R]
ti[R]
Public Class Methods
new(options = {})
click to toggle source
# File lib/geotagger/geotagger.rb, line 13 def initialize(options = {}) @verbose = options[:verbose] @ee = ExifEditor.new options @ti = TrackImporter.new @ti.verbose = @verbose end
Public Instance Methods
add_all_files(time_offset = 0)
click to toggle source
Add all GPX and images with
# File lib/geotagger/geotagger.rb, line 21 def add_all_files(time_offset = 0) # add all GPX Dir.glob("**/*.GPX", File::FNM_CASEFOLD).each do |f| add_gpx_file(f) end # add all GPX Dir.glob("**/*.JPG", File::FNM_CASEFOLD).each do |f| add_image(f, time_offset) end Dir.glob("**/*.JPEG", File::FNM_CASEFOLD).each do |f| add_image(f, time_offset) end end
add_gpx_file(path)
click to toggle source
# File lib/geotagger/geotagger.rb, line 36 def add_gpx_file(path) @ti.add_file(path) end
add_image(path, time_offset = 0)
click to toggle source
# File lib/geotagger/geotagger.rb, line 40 def add_image(path, time_offset = 0) @ee.read_file(path, time_offset) end
fix_times()
click to toggle source
# File lib/geotagger/geotagger.rb, line 44 def fix_times @ee.fix_times end
match_up()
click to toggle source
# File lib/geotagger/geotagger.rb, line 48 def match_up @ti.determine_directions @ee.images.each do |i| puts "* searching for #{i}" if @verbose i[:coord] = @ti.find_by_time(i[:time]) if i[:coord].nil? puts " - not found" if @verbose else @ti.add_image_marker(i) end end end
save!()
click to toggle source
Save all coords
# File lib/geotagger/geotagger.rb, line 63 def save! @ee.images.each do |i| if not i[:coord].nil? puts "! saving for #{i[:path]}" if @verbose i.save! end end end
simulate()
click to toggle source
# File lib/geotagger/geotagger.rb, line 73 def simulate to_process = @ee.images.select { |i| not i[:coord].nil? } puts "Result: to update #{to_process.size} from #{@ee.images.size}" if @verbose end