ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: Raffie77 on May 11, 2020, 02:30:55 AM

Title: Can I make a frm file that creates a CSV file from filename and reverse geocode?
Post by: Raffie77 on May 11, 2020, 02:30:55 AM
Hello,

can I create a CSV file that does this:
filename, gps [gps cords and name of city, country etc.]
there is this api:

when I execute this:
curl "https://nominatim.openstreetmap.org/reverse?format=geojson&lat=52.2797235&lon=6.7144513" | jq '.features[].properties.display_name'

I get
IJsbaanweg, Ambt Delden, Hof van Twente, Overijssel, Nederland, 7495VK, Nederland

I just want a CSV file that has this data , or does exiftool has a better way to do this?

or can I create a bash script to get what I want with or without a frm file?
Title: Re: Can I make a frm file that creates a CSV file from filename and reverse geocode?
Post by: Phil Harvey on May 11, 2020, 09:14:39 AM
ExifTool can not look up place names based on GPS coordinates if that is what you are trying to do.

I don't know what an frm file is.

- Phil
Title: Re: Can I make a frm file that creates a CSV file from filename and reverse geocode?
Post by: Raffie77 on May 11, 2020, 11:00:02 AM
Shoot my bad I mean fmt file for the -printFormat

But I fixed it

this is my bash script:

#!/bin/bash
output_file="/Users/ralphschipper/temp/test.csv" # <- Choose your output file here

echo "Name\t GPS\t Place" > "$output_file"

for file in "$@"; do
lat=$(/usr/local/bin/exiftool -T -n -c "%.7f" -GPSLatitude "$file")
lon=$(/usr/local/bin/exiftool -T -n -c "%.7f" -GPSLongitude "$file")

if [[ ${#lat} -gt 2 ]]
then
geo=$(curl -s "https://nominatim.openstreetmap.org/reverse?format=geojson&lat=${lat}&lon=${lon}" | jq '.features[].properties.display_name')
data=$(/usr/local/bin/exiftool -T -filename "${file}")
data+="\t"
data+="$lat,$lon"
data+="\t"
data+=$geo
else
data=$(/usr/local/bin/exiftool -T -filename "${file}")
data+="\t"
data+="-"
data+="\t"
data+="-"
fi
echo $data >> "$output_file"
done
open "$output_file"


what it does?
open this bash file and drag some photo's to the terminal
if the photo has GPS data it wil show the city, street, country etc.

for the photo's that does not have gps data you see a minus sign (-)