Can I make a frm file that creates a CSV file from filename and reverse geocode?

Started by Raffie77, May 11, 2020, 02:30:55 AM

Previous topic - Next topic

Raffie77

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?

Phil Harvey

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

Raffie77

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