how to locate pictures within a specific radius ?

Started by sevy, April 13, 2020, 10:23:30 AM

Previous topic - Next topic

sevy

Hello,

I'm trying to find pictures taken in a specific aera, within a radius of 1 (or 2 or 5 or...) km, from 27,470316; 89,639640 (= N27°28'13.14" E89°38'22.70") (an example).

I found 3 posts concerning this topic :
https://exiftool.org/forum/index.php?topic=6789.0
https://exiftool.org/forum/index.php/topic,6193.msg30587.html#msg30587
https://exiftool.org/forum/index.php?topic=7491.0

I noticed that "abs($gpslatitude# - 27,470316) < 1e-6 and abs($gpslongitude# - 89,639640) < 1e-6" seems to be the normal syntax

But I can's understand how to use it. What does '< 1e-6' or '< 1e-3' or '1' mean ?
How to specify the radius within I would like to search ?

Thanks in advance for your help.


Sevy (w10)

Phil Harvey

First, you need to use decimals and not commas in your real values (ie. "27.470316").

The 1e-6 is exponential notation for 0.000001, and 1e-3 is 0.001.

To calculate the distance is a bit tricky... give me a minute on that one.

- 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 ($).

Phil Harvey

Hi Sevy,

OK.  Here you go.

exiftool -filename -if "$toRad=3.14159/180;$conv=6371*$toRad;(($gpslatitude#-$lat)*$conv)**2 + (($gpslongitude#-$lon)*$conv*cos($gpslatitude#*$toRad))**2 < $dist*$dist" -userparam lat=27.470316 -userparam lon=89.639640 -userparam dist=2 DIR

This will print the file name of any file with coordinates within 2 km of the specified position.  The -userparm option is used to set the lat/lon of the position and the distance threshold in km.

I have used a spherical earth approximation with a radius of 6371 km.  I haven't tested this to make sure the calculation is correct, but it stands a chance of working properly.

- 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 ($).

sevy

Hello Phil,

Thank you very much ! It's working !
Exiftool is really the Swiss Army Knife of metadata world... and you're the McGyver :-)

To be honest, I don't understand everything and it reminded me that the radius of the earth was not equal in all parts of the world.

Sevy

Phil Harvey

Hi Sevy,

Yes, I debated upon which value of the radius to use.  I settled on the volumetric mean radius, but in reality it really doesn't matter much which one you choose for this.

Love the McGyver reference.  Really liked that show.

- 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 ($).