New Cmd-Line Options Suggestions

Started by WonderfulExif, October 13, 2017, 06:28:48 PM

Previous topic - Next topic

WonderfulExif

1. New Cmd-Line Option to Output GPS Coordinates as Google Maps URL with Zoom
e.g.
http://maps.google.com/maps?t=m&z=4&mrt=yp&t=k&q=37°33'26.94"S+144°21'34.96"E

Maybe it could be something like:
exiftool -googlemaps[n] Name.jpg
Where the Optional [n] is the Zoom Value, the default being 4
exiftool -googlemaps15 Name.jpg
This would output:
http://maps.google.com/maps?t=m&z=15&mrt=yp&t=k&q=37°33'26.94"S+144°21'34.96"E

2. New Cmd-Line Option for Opening the Google Map in the Google Chrome WEB Browser
exiftool -chrome -googlemaps15 Name.jpg
Maybe this one is too much because "Where is the Chrome binary?" depends on the OS... Unix;Mac;Windows

***************************************************************************************
3. New Cmd-Line Option to Rename Image As... NewNameString_DateTime[Format]_GoogleMapsCoordinates
Where:
NewNameString: a Persons Name eg. Joe_Bloggs
DateTime: Image Creation DateTime
Format: Optional Date/Time Format String. The default Date Format would be UnixEpoch
GoogleMapsCoordinates: Different from above (Numeric)

The New Cmd-Line could be something like:
exiftool -FileName Joe_Bloggs ["date format"] -googlemaps[n] Name.jpg
This would rename Name.jpg to:
Joe_Bloggs_AsPerDataFormat_39.5450162_-99.3684743_15z.jpg

eg.
exiftool -FileName Joe_Bloggs -googlemaps[n] Name.jpg
This would rename Name.jpg to:
Joe_Bloggs_1507600641_39.5450162_-99.3684743_15z.jpg


Thanks for the opportunity to make these suggestions

Phil Harvey

Thanks for the suggestions, but adding google-specific command-line options doesn't make sense (there are already too many command-line options), however your suggestions 1 and 3 can be accomplished with the -p option, or with user-defined Composite tags.  And you should be able to do number 2 by piping the output of ExifTool to the Chrome command line.

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

StarGeek

Under Windows, Chrome won't take an url from a pipe as input.  But a Bat file would probably work and could include the zoom factor option

The third option is for renaming.  You can't do that with -p, can you?  But the -c option would fit the bill I would think.

Here's a Windows Bat file I came up with for the second option.  It takes a filename and optional zoom level as input, creates the URL for Google Maps, and then opens the URL in the default browser.  Works here with (very) limited testing.

echo off
:: Set Zoom default to 4 if not added on the command line
set Zoom=%~2
if "%2"=="" (set Zoom=4)

:: Insert Zoom into URL
set URL="http://maps.google.com/maps?t=m&z=%Zoom%&mrt=yp&t=k&q=${GPSLatitude}+${GPSLongitude}"

:: Run Exiftool command, save output
for /f "tokens=*" %%i in (' exiftool -c "%%+.6f" -p ""%URL%"" %1 ') do set VAR=%%i

:: Open default browser to completed URL
cmd /c start "" %VAR%
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

Phil Harvey

Thanks StarGeek,

Quote from: StarGeek on October 13, 2017, 08:14:34 PM
Under Windows, Chrome won't take an url from a pipe as input.

Windows doesn't have the equivalent of a backtick operator?  Pity.

QuoteThe third option is for renaming.  You can't do that with -p, can you?

Correct, but you can use the same type of advanced formatting expressions when copying other tags to FileName.

QuoteBut the -c option would fit the bill I would think.

And probably easier.

QuoteHere's a Windows Bat file I came up with for the second option.

Nice!

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

WonderfulExif

Thanks StarGeek and Phil,
Your suggestions were very helpful.

My goal is to rename the img.jpg as...
FirstName_SecondName_EpochCreateDate_GPSLatitude_GPSLongitude.jpg
I want the name to be pure text so that I can take advantage of doubleClick/trippleClick select in the OS GUI
eg. In Windows 10 file explorer just SLOWLY doubleclick/trippleClick on the filename to select it
Characters "Space + - . " are treated like delimiters in many GUI`s,
so you have to click and drag to select the whole name where these are used.
This varies in different OS GUI`s and Command Interpreters
I want this to work in as many OS GUI`s as possible

In the real world + before a number is not required for positive numbers
I will remove "+", I will replace "-" with m, "." identifies the file extension so I will replace it with d
So this is the result I want
Joe_Bloggs_1507094874_m37d578767_143d836119.jpg
Is it possible to format the output of exiftool to do this in one line?

I don't know how to overcome a problem in the following command line
exiftool -c "%+.6f" -d "%s" -p "Joe_Bloggs_$CreateDate_$GPSLatitude_$GPSLongitude" img.jpg
"$CreateDate_" and "$GPSLatitude_" are faulty because they are interpreted as ending with "_"

This sort of works, but needs further post processing
exiftool -c "%+.6f" -d "%s" -p "Joe_Bloggs_$CreateDate~$GPSLatitude~$GPSLongitude" img.jpg
Joe_Bloggs_1507094874~-37.578767~+143.836119.jpg

I know I can post process/pipe thru other programs like *.BAT *.sh *.php *.pl afterwards
but I would rather do it all in one formatted command line because I want a universal exiftool command line that does what I want in all OS`s
(all the flavours of Windows and Unix AND all flavours of Text Editors, Command/Shells)
I have thousands of images to process in many different ways and environments so this double click thing saves heaps of time

The trouble with standards is there are NONE... because there are TOO MANY none of them are standard!

Thanks for your help



StarGeek

Use braces to separate the GPS variables from the rest of the line (see -p option).  Additionally, you can then use advanced formatting to make the changes you desire to the GPS data.

Since you wish to rename the file, your final command would be something like this:
exiftool -c "%+.6f" -d "%s" "-Filename<Joe_Bloggs_${CreateDate}_${GPSLatitude;s/^\+//;tr/-./md/}_${GPSLongitude;s/^\+//;tr/-./md/}%E" img.jpg

Test it out first by replacing Filename with Testname to see the results without actually renaming files.  Example:
C:\>exiftool -c "%+.6f" -d "%s" "-testname<Joe_Bloggs_${CreateDate}_${GPSLatitude;s/^\+//;tr/-./md/}_${GPSLongitude;s/^\+//;tr/-./md/}%E" y:\!temp\Test3.jpg
'y:/!temp/Test3.jpg' --> 'y:/!temp/Joe_Bloggs_1012644122_40d689200_m74d044500.jpg'
    0 image files updated
    1 image files unchanged
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

WonderfulExif