@ECHO OFF SETLOCAL IF "%~1"=="" GOTO Syntax IF "%~1"=="/?" GOTO Syntax IF NOT "%~2"=="" GOTO Syntax IF NOT EXIST "%~1" ( ECHO. ECHO ERROR: File not found GOTO Syntax ) exiftool.exe >NUL 2>&1 IF ERRORLEVEL 1 ( ECHO. ECHO ERROR: EXIFTool.exe not found GOTO Syntax ) FOR /F "tokens=2 delims=:" %%A IN ('exiftool.exe -a -G -gpslatitude "%~1"') DO CALL :Calculate Latitude "%%~A IF "%Latitude%"=="" ( ECHO. ECHO ERROR: No EXIF data or no GPS values in EXIF data GOTO Syntax ) FOR /F "tokens=2 delims=:" %%A IN ('exiftool.exe -a -G -gpslongitude "%~1"') DO CALL :Calculate Longitude "%%~A IF "%Longitude%"=="" ( ECHO. ECHO ERROR: No EXIF data or no GPS values in EXIF data GOTO Syntax ) ECHO %Latitude%, %Longitude% START "Show on OpenStreetMap" "https://www.openstreetmap.org/?mlat=%Latitude%&mlon=%Longitude%&zoom=16" ENDLOCAL EXIT /B 0 :Calculate SETLOCAL ENABLEDELAYEDEXPANSION FOR /F "usebackq tokens=1,3,4 delims=' " %%B IN (`ECHO %~2`) DO ( SET Degrees=%%B SET /A Minutes = %%C SET Seconds=%%D SET Seconds=!Seconds:.=! SET /A Fraction = 6000 * !Minutes! + !Seconds! SET /A "Fraction = ( 1800 + 100 * !Fraction! ) / 3600" ) ENDLOCAL & SET %1=%Degrees%.%Fraction% GOTO:EOF :Syntax ECHO. ECHO GetLocation.bat, Version 1.00 ECHO Open OpenStreetMap on the GPS coordinates of the specified photograph ECHO. ECHO Usage: GetLocation.bat photo ECHO. ECHO Where: photo is the path to the photograph whose location you want to find ECHO. ECHO Notes: Requires Phil Harvey's ExifTool: ECHO https://exiftool.org/ ECHO The author is in no way affiliated with OpenStreetMap: ECHO https://www.openstreetmap.org/ ECHO ErrorLevel 1 in case of ^(command line^) errors, otherwise 0. ECHO. ECHO Written by Rob van der Woude ECHO https://www.robvanderwoude.com ENDLOCAL EXIT /B 1