Add GPS exif tags to images/videos based on a kml file
Ruby
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
bin
lib
spec
.gitignore
.rubocop.yml
CHANGELOG.md
Gemfile
Guardfile
LICENSE
README.md
exif_gps_injector.gemspec

README.md

Exif GPS Injector

Add GPS exif tags to images/videos based on a kml file Does not work with new Google Kml files

Google KML files

Google updated their KML files structure after 2016/04 making the injector fails. The only accepted format is the old one you can see here.

Installation

  gem install exif_gps_injector

Usage

Command line

Copy images and kml to the same folder:

❯❯❯ exif_gps_injector --help
Usage: exif_gps_injector [options]
        --fallback-location LOCATION Fallback to this location if can't locate on kml
        --gps-refs REFS              Default South/West
        --input-dir INPUT_DIR        Directory to read media files, default to ./
        --kml-dir KML_DIR            Directory to read the kml files, default to ./
        --max-distance-time DISTANCE KML max distance in time from original date
        --replace-original-files     Default to false
❯❯❯ exif_gps_injector --replace-original-files
23 files found
2621 location points

Injecting: |======================================================================

 Finished!

Ruby

  kml = ExifGpsInjector::Kml.new(dir: options[:kml_dir])
  kml.locate_at('2015-01-01 12:00') => '-42.000 -10.000 0'

  media = ExifGpsInjector::Media.new('./image.jpg')
  media.original_date_time  => '2015-01-01 12:00'
  media.location = { gps_latitude: '-10.000', gps_longitude: '-42.000', gps_altitude: 0 }

License

MIT License. Copyright 2016 Jhimy Fernandes Villar.