May 2025 Archives
My wife and I travel a bit and on most occasions, we'll take both our iPhones and a big Nikon D750 with equally weighty lens for zooming in a bit or catching something really quick and quickly. (I'm fumblefingers with the iPhone when trying to do anything fast, and the Nikon is point-and-shoot easy with a big red button.)
The problem with this arrangement is that the Nikon pics don't end up with location information on them, and I'm not about to spend bucks for an awkward GPS location dingus that attaches to the camera's hotshoe. That's just asking for more trouble. However, when we're both taking pictures, location information is "just over there" in the iPhone, and as long as the dates and times agree, more or less, it seemed reasonable to just take the location info from the iPhone photo and "smear" it onto the subsequent Nikon photos.
Now, this algorithm is simple and robust, but it has its limitations. Clearly, it won't work if I took a Nikon shot before she took an iPhone shot. That Nikon shot would be lumped in with previous phone photos. And it doesn't help if the Nikon was the only camera used at a location, or if the Nikon is in motion without accompanying iPhone photos. I had a brief go at correcting these problems programatically, but it really didn't seem to be worth it for the odd photo which was mis-located.
Practically, the solution is reasonably simple: just take an iPhone photo phirst, then take Nikon photos to my heart's content.
Here's the AppleScript, provided without any warranty whatsoever. And if you make any improvements to it, please feel free to publish them—just let me know, please, so I can take advantage of your smarts!
Also, thanks to Moth Software for their very useful AppleScript to HTML converter so you can see pretty code below!
tell application "Photos"
set theKeyword to "Automatic Location"
set lastLocation to {missing value, missing value}
set currentSelection to the selection
repeat with thisPhoto in currentSelection
if location of thisPhoto is not {missing value, missing value} then
set lastLocation to location of thisPhoto
else if location of thisPhoto is {missing value, missing value} ¬
and lastLocation is not {missing value, missing value} then
set location of thisPhoto to lastLocation
if keywords of thisPhoto is missing value then
set keywords of thisPhoto to theKeyword
else
set keywords of thisPhoto to (get keywords of thisPhoto) & theKeyword
end if
end if
print location
print keywords of thisPhoto
end repeat
end tell
Recent Comments
Joel Bernstein on More on Why I Think "two ex" Isn't As Likely As "any ex": The issue
Public Farley on I Side With Engadget: Cold Water on the iPad 2 Retina Display Hype | Daring Fireball: Nice post!
Bill Eccles on How Not to be Prepared for 24" of Snow (And Some Advice): I feel you
Janine F. on How Not to be Prepared for 24" of Snow (And Some Advice): Yeah, I sh
Greg on Note to Gruber: Democratic Congresswoman Gabrielle Giffords Shot in the Head at Public Event in Arizona | DaringFireball.net: This is ex
Bill Eccles on Designed to Fail: Apple Time Machine and MacOS X Server: Funny thin
Quentin Smith on Designed to Fail: Apple Time Machine and MacOS X Server: I just had
Anton E. on Building a Mac OS X Server 10.6: Step 1, Adventures With PHP [Updated 1/24/10 and 1/30/10]: Hi, I ve b
Arthur Nisnevich on Building a Mac OS X Server 10.6: Step 1, Adventures With PHP [Updated 1/24/10 and 1/30/10]: Thank you!