Adding GPSLatitude/GPSLongitude

General Discussion of Scripting for Adobe Bridge

Moderators: Kukurykus, Tom, xbytor

sdouglas
Posts: 2
Joined: Wed Mar 29, 2017 8:13 pm
Location: Florida

Adding GPSLatitude/GPSLongitude

Post by sdouglas »

Hello,

I have been using Paul's script to add metadata to photos in subfolders and it is a lifesaver!

However, I need to tweak a few things for our organization. To keep it simple, I will focus on latitude and longitude here. I would like to be able to import lat/long from 2 columns in a CSV file.

First: Does the lat/long need to be in a certain format in the CSV file? Right now its simply decimal degrees (ex: 35.92, -35.92). I see that the metadata also allows for GPSLatitudeRef and GPSLongitudeRef, are these in the same columns as the lat/long (ex: 35.92N) or would there be a separate column for N,S and a separate column for E,W?

Second: I don't know much, if anything about EXIF and metadata standards in general, so correct me if I'm wrong. I found a topic on another forum that mentioned GPSLatitude and GPSLongitude and using XMPConst.NS_EXIF so using Paul's script I've added the functionality into the GUI and whatnot, but I think I'm stuck on the application towards the bottom in the if(doXXX) section.

Here is my go at it. Does this look about right?

Code: Select all

        
if(doLat){
try{
myXmp.deleteProperty(XMPConst.NS_EXIF, "GPSLatitude");
myXmp.setProperty(XMPConst.NS_EXIF, "GPSLatitude", Lat);
}catch(e){sendError(errorLog,decodeURI(fileName)+" :: Bad Headline : "+Lat);}
}

if(doLong){
try{
myXmp.deleteProperty(XMPConst.NS_EXIF, "GPSLongitude");
myXmp.setProperty(XMPConst.NS_EXIF, "GPSLongitude", Long);
}catch(e){sendError(errorLog,decodeURI(fileName)+" :: Bad Headline : "+Long);}
}
Am I on the right track?

sdouglas
Posts: 2
Joined: Wed Mar 29, 2017 8:13 pm
Location: Florida

Re: Adding GPSLatitude/GPSLongitude

Post by sdouglas »

Update: I was able to get this to work, I simply renamed every reference to lat/long throughout the code to GPSLatitude and GPSLongitude. Example:

Code: Select all

        
if(doLat){
try{
myXmp.deleteProperty(XMPConst.NS_EXIF, "GPSLatitude");
myXmp.setProperty(XMPConst.NS_EXIF, "GPSLatitude", GPSLatitude);
}catch(e){sendError(errorLog,decodeURI(fileName)+" :: Bad Headline : "+GPSLatitude);}
}

if(doLong){
try{
myXmp.deleteProperty(XMPConst.NS_EXIF, "GPSLongitude");
myXmp.setProperty(XMPConst.NS_EXIF, "GPSLongitude", GPSLongitude);
}catch(e){sendError(errorLog,decodeURI(fileName)+" :: Bad Headline : "+GPSLongitude);}
}
Now, the format that comes out looks like Degrees, Minutes, Seconds N/S/E/W (ex: 90,1,15 N).