Author Topic: [macOS] Tag image files containing any gps data  (Read 147 times)

magikct

  • Newbie
  • *
  • Posts: 7
[macOS] Tag image files containing any gps data
« on: April 04, 2019, 08:03:40 AM »
Hi,
I'm looking for solution that allows me to tag (for example, the red tag) in Finder files that contain any GPS data. Can anyone help me?
I would like it to work like this:
Find first image file in current folder (JPEG, TIFF or RAW) -> check if file contains GPS data -> if no -> find second image -> check if it contains GPS data -> if yes ->
Code: [Select]
tag secondimage.jpg -a 'Red' -> find third file ...

Thanks in advance!
« Last Edit: April 04, 2019, 08:16:33 AM by magikct »

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 14438
    • ExifTool Home Page
Re: [macOS] Tag image files containing any gps data
« Reply #1 on: April 04, 2019, 08:16:06 AM »
How about something like this?:

exiftool -MDItemFSLabel=6 -if '$gpslatitude' DIR

- Phil
« Last Edit: April 04, 2019, 08:31:30 AM by Phil Harvey »
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

magikct

  • Newbie
  • *
  • Posts: 7
Re: [macOS] Tag image files containing any gps data
« Reply #2 on: April 04, 2019, 08:30:05 AM »
YES! It's working!
but in the above was a typo (should be '-' before 'if').
Thank you!
Can I assign my own tag name from the finder, e.g. 'GPSdataHERE'?

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 14438
    • ExifTool Home Page
Re: [macOS] Tag image files containing any gps data
« Reply #3 on: April 04, 2019, 08:33:14 AM »
in the above was a typo (should be '-' before 'if').

Thanks.  I've fixed this mistake.

Quote
Can I assign my own tag name from the finder, e.g. 'GPSdataHERE'?

See the MacOS tags documentation for a list of available Finder tags.  Only a few are writable, but these should give you what you want.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

magikct

  • Newbie
  • *
  • Posts: 7
Re: [macOS] Tag image files containing any gps data
« Reply #4 on: April 04, 2019, 08:38:47 AM »
Phil, I can assign any tag I want.
See an example:

MacBook:folder user$ tag example.jpg -a 'GPSdataHERE'
MacBook:folder user$

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 14438
    • ExifTool Home Page
Re: [macOS] Tag image files containing any gps data
« Reply #5 on: April 04, 2019, 08:42:42 AM »
Yes.
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

magikct

  • Newbie
  • *
  • Posts: 7
Re: [macOS] Tag image files containing any gps data
« Reply #6 on: April 04, 2019, 08:54:36 AM »
But how can I combine both commands?

EDIT:

It's working now that I want.
exiftool -MDItemUserTags=GPSdataHERE -if '$gpslatitude' .


Thanks a lot for quick response and help!
« Last Edit: April 04, 2019, 09:09:40 AM by magikct »

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 14438
    • ExifTool Home Page
Re: [macOS] Tag image files containing any gps data
« Reply #7 on: April 04, 2019, 09:09:56 AM »
Did you look at the MacOS tag documentation that I linked?
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

magikct

  • Newbie
  • *
  • Posts: 7
Re: [macOS] Tag image files containing any gps data
« Reply #8 on: April 04, 2019, 09:10:37 AM »
Yes. thanks!

magikct

  • Newbie
  • *
  • Posts: 7
Re: [macOS] Tag image files containing any gps data
« Reply #9 on: April 04, 2019, 05:17:03 PM »
Phil I have another question:
How to append tag "GPSdataHERE" to existing file tags instead of replace all tags with one "GPSdataHERE" ?

StarGeek

  • Global Moderator
  • ExifTool Freak
  • *****
  • Posts: 2372
Re: [macOS] Tag image files containing any gps data
« Reply #10 on: April 04, 2019, 05:34:40 PM »
Use += instead of just =

exiftool -MDItemUserTags+=GPSdataHERE -if '$gpslatitude' .
Troubleshooting hints:
* When posting, include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).
* Double all percent signs (%) in a Windows batch file.
* If your GPS coords are negative, make sure and set the GpsLatitudeRef and GpsLongitudeRef tags correctly.

magikct

  • Newbie
  • *
  • Posts: 7
Re: [macOS] Tag image files containing any gps data
« Reply #11 on: April 04, 2019, 06:45:07 PM »
Great! Thanks guys. My life is better now.