Skip to content

Instantly share code, notes, and snippets.

Created December 20, 2012 08:07
Show Gist options
  • Save anonymous/4343697 to your computer and use it in GitHub Desktop.
Save anonymous/4343697 to your computer and use it in GitHub Desktop.
extract GPS info and print a Google Maps URL in the terminal.
source :rubygems
gem 'exifr', github: 'remvee/exifr'
#!/usr/bin/env ruby
# encoding: UTF-8
require 'bundler/setup'
Bundler.require(:default)
ARGV.each do |img|
gps = EXIFR::JPEG.new(img).gps
unless gps
puts "#{img} => no GPS data"
next
end
puts "\n#{img}\nhttp://maps.google.com/maps?q=loc:#{gps.latitude},#{gps.longitude}"
end
puts
# install and run
bundle install
chmod +x map.rb
./map.rb IMG1.jpg IMG2.jpg
# outputs something like
IMG1.jpg
http://maps.google.com/maps?q=loc:52.7197888888889,5.28397777777778
IMG2.jpg
http://maps.google.com/maps?q=loc:35.7197888888889,139.7197888888889
@jfeltesse
Copy link

created when not signed in...... sigh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment