ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: mhulse on July 25, 2017, 06:30:07 PM

Title: [solved] Geo tagging: How to get GPSLatitudeRef, GPSLongitudeRef from lat/lon?
Post by: mhulse on July 25, 2017, 06:30:07 PM
Hello,

I am hoping someone can give me some advice.

I am trying to geo tag an equirectangular pano image.

I have the lat/lon:

70.68833887786599,-52.10783369649505

I don't have the cardinal directions.

Reading the exiftool docs (https://exiftool.org/TagNames/GPS.html), it says:

QuoteWhen adding GPS information to an image, it is important to set all of the following tags: GPSLatitude, GPSLatitudeRef, GPSLongitude, GPSLongitudeRef, and GPSAltitude and GPSAltitudeRef if the altitude is known. ExifTool will write the required GPSVersionID tag automatically if new a GPS IFD is added to an image.

Is there a way for me to determine the NSEW if I just have the lat/lon?

Thanks!
Title: Re: Geo tagging: How to get GPSLatitudeRef, GPSLongitudeRef from lat/lon?
Post by: StarGeek on July 25, 2017, 08:01:16 PM
Stealing from this stackexchange answer (https://stackoverflow.com/a/4537044/3525475):

"Positive latitude is above the equator (N), and negative latitude is below the equator (S).

Positive longitude is east of the prime meridian, while negative longitude is west of the prime meridian (a north-south line that runs through a point in England)."

But to make things easy, you can go ahead an assign the GPS*Ref tags directly with the same data and Exiftool will figure it out for you.  That can make it easier if you are trying to automate the process (less so if you are typing it out :) )

exiftool -GPSLatitude=70.68833887786599 -GPSLatitudeRef=70.68833887786599 -GPSLongitude=-52.10783369649505 -GPSLongitudeRef=-52.10783369649505 FileOrDir

Example output after using the above command:
C:\>exiftool -GPSLat* -GPSLong* X:\!temp\Test3.jpg
GPS Latitude                    : 70 deg 41' 18.02" N
GPS Latitude Ref                : North
GPS Longitude Ref               : West
GPS Longitude                   : 52 deg 6' 28.20" W
Title: Re: Geo tagging: How to get GPSLatitudeRef, GPSLongitudeRef from lat/lon?
Post by: mhulse on July 25, 2017, 08:11:24 PM
Thank you so much for your helpful and informative reply StarGeek! I really appreciate it! :)

I am automating, so your code example will work perfectly for me.

Many many thanks!