It's probably as buggy as all ****, but this is what I hacked together out of some other scripts that a much more talented coder (léonie) wrote. It appears to work, but will probably crash in flames on some corner case somewhere.
(* select at least 3 images in Photos *)
tell application "Photos"
activate
set imageSel to (get selection)
if (imageSel is {}) or (the length of imageSel < 3) then
error "Please select at least three images."
else
set withAlti to false
set withLati to false
set withLongi to false
set withTime to false
-- Get start point GPS lat/long and time
try
tell the first item of imageSel
set loc to get the location --retrieve longitude and latitude as list
set alti to get the altitude -- retrieve the altitude
set lati_1 to (the first item of loc) -- as number
set longi_1 to (the second item of loc) -- as number
set first_date to the date of the first item of imageSel as date -- retrieve the date
-- return altiS
set withAlti to (alti is not equal to missing value)
set withLati to (lati_1 is not equal to missing value)
set withLongi to (longi_1 is not equal to missing value)
set withTime to (first_date is not equal to missing value)
if not withLati then
set withLati to false
error "First Photo has no Latitude assigned"
end if
if not withLongi then
error "First Photo has no Latitude assigned"
end if
if (lati_1 > 90.0) or (lati_1 < -90.0) then
error "Latitude out of range " & lati_1
end if
if (longi_1 > 180.0) or (longi_1 < -180.0) then
error "Longitude out of range " & longi_1
end if
if not withTime then
error "First Photo has no date stamp"
end if
end tell
on error errTexttwo number errNumtwo
display dialog "No GPS: " & errNumtwo & return & errTexttwo
return
end try
-- Get end point GPS lat/long and time
try
tell the last item of imageSel
set loc to get the location --retrieve longitude and latitude as list
set alti to get the altitude -- retrieve the altitude
set lati_2 to (the first item of loc) -- as number
set longi_2 to (the second item of loc) -- as number
set last_date to the date of the last item of imageSel as date -- retrieve the date
-- return altiS
set withAlti to (alti is not equal to missing value)
set withLati to (lati_1 is not equal to missing value)
set withLongi to (longi_2 is not equal to missing value)
set withTime to (first_date is not equal to missing value)
if not withLati then
set withLati to false
error "Last photo has no Latitude assigned"
end if
if not withLongi then
error "Last photo has no Latitude assigned"
end if
if (lati_2 > 90.0) or (lati_2 < -90.0) then
error "Latitude out of range " & lati_2
end if
if (longi_2 > 180.0) or (longi_2 < -180.0) then
error "Longitude out of range " & longi_2
end if
if not withTime then
error "last photo has no date stamp"
end if
end tell
on error errTexttwo number errNumtwo
display dialog "No GPS: " & errNumtwo & return & errTexttwo
return
end try
if (not withLongi or not withLati) then
return {loc, alti} --testing
end if
set timeWindow to (last_date - first_date)
repeat with i from 2 to ((count of imageSel) - 1)
set next_image to item i of imageSel
tell next_image
set imageDate to get the date of item i of imageSel
set percentAlongPath to (imageDate - first_date) / timeWindow
set its location to {(1 - percentAlongPath) * lati_1 + percentAlongPath * lati_2, (1 - percentAlongPath) * longi_1 + percentAlongPath * longi_2}
-- if withAlti then -- photo has altitude tag
-- set its altitude to alti
-- end if
end tell
if withAlti then -- photo has altitude tag
tell next_image
-- set its altitude to alti as number -- does not work
end tell
end if
end repeat
end if
return {loc, alti, "Done"} -- for testing
end tell