Last active
December 28, 2015 16:59
-
-
Save webapprentice/7532569 to your computer and use it in GitHub Desktop.
Server action code for this tutorial
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Extract EXIF metadata from a photo on the server | |
get '/tutorial_22_demo_1' do | |
# load the library file that contains methods used this tutorial | |
require 'lib/tutorial_22.rb' | |
# Extract the metadata from an image file on the server | |
@photo = MiniExiftool.new(File.join(root_dir, "/public/assets/photo_metadata_1_400.jpg")) | |
# Get the Latitude and Longitude values and convert to decimal format | |
@latitude_0 = dms_to_decimal(@photo['GPSLatitude']) | |
@longitude_0 = dms_to_decimal(@photo['GPSLongitude']) | |
# Compute a second Lat/Lon pair along the direction the image was taken - used to draw a line on the map | |
bearing = @photo['GPSImgDirection'].to_f | |
@latitude_1, @longitude_1 = latlong_offset(@latitude_0, @longitude_0, bearing, 0.5) | |
erb :tutorial_22_demo_1 | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment