Sample Powershell for quick GPS data display from folder tree of jpgs

Started by dwids, December 21, 2021, 06:08:06 PM

Previous topic - Next topic


Hello Phil. Thanks for the great tool. I've recently taught myself PowerShell and thought others may find this simple script useful. You pass in a root folder and it does a quick display of the jpgs that have GPS data, plus that GPS data.   It's recursive.

Format: quickImages_to_LatLong.ps1 'D:\D_Photos\2021\01\22'   

I use this output in a web-service to manually do a reverse-geoLocation, via the Lat and Long. So it tells me where the photo was taken; viz town, road, tourist location etc.  This is a 'quick' lookup. I have other scripts that use your output and automatically put the web-service results into a Database. So I can ask, via SQL , 'when did I go to Sydney?' or 'what trips did I do in Jan 2019?'

# quickImages_to_LatLong.ps1.  Pass in folder.

param (
[Parameter(Mandatory = $true, ValueFromPipeline = $true)] $folder

# run Exiftool against the Folder (recursive) with output as json. Convert that output from json to a PowerShell custom object ($data)
$data = (exiftool -if '$gpsdatetime' -s -s -s -json -ext jpg -filename -FileTypeExtension -Directory -CreateDate -GPSDateTime -GPSLatitude -GPSLongitude -n -r $folder) | ConvertFrom-Json

# No need to loop through the object's contents, just directly select/show the Properties we want:
$data | select-object SourceFile, CreateDate, GPSLatitude, GPSLongitude