The pasting added additional line breaks.
I Sierra is an easier way. The maps.app can show latitude and longitude in the Info panel, if you drop a pin. So I would just install the "Show photo on Map" Automator action from this page. https://macosxautomation.com/automator/photos/maps-action.html
The script should look like this:
-- This script will display the GPS values and the altitude for a selected photo in a dialog panel.
-- The coordinates will be copied to the clipboard
on ensure_val(the_value, default_value)
-- if the_value is defined return the value, otherwise the default value
if the_value is equal to "missing value" then
return default_value
else
return the_value
end if
end ensure_val
-- on run {}
tell application "Photos"
activate
set imageSel to (get selection) -- get the selected image
if imageSel is {} then
error "Please select an image."
end if
tell the first item of imageSel
set loc to get the location--retrieve longitude and latitude as list
set lati to (the first item of loc) as string
set longi to (the second item of loc) as string
set alti to get the altitude as string-- retrieve the altitude
end tell
end tell
-- check for undefined values
set lati to ensure_val(lati, "latitude empty")
set longi to ensure_val(longi, "longitude empty")
set alti to ensure_val(alti, "altitude empty")
-- display the result in a dialog panel
set panel_message to "Latitude: " & lati & "
Longitude: " & longi & "
Altitude: " & alti & "
Copied to the clipboard"
display dialogpanel_messagebuttons ¬
"OK" with iconcautiondefault button "OK"
-- copy the GPS data to the clipboard
set clipboard_message to " " & lati & " " & longi & " " & alti
set the clipboard toclipboard_message
return clipboard_message
-- end run