Copy link to clipboard
Copied
Since Adobe Bridge stupidly enough uses a non standard GPS format
you must convert the Bridge GPS coordinates to any of the standard formats before you can use the GPS location on for instance Google Maps.
how to convert Bridge GPS coordinates
to
Degrees and decimal minutes (DMM)
or
Decimal format (DD):
Bridge format could be:
57,46.79 N
12,2.4607E
It is close to the DMM format which is
57 degrees and 46.79 minutes N and
12 degrees 2.4607 minutes E.
Converting to DD (decimal):
57,46.79N =
57 + 46.79/60 = 57 + 0.7798333 = 57.779833
12,2.4607E =
12 + 2.4607/60 = 12 + 0.041011666 = 12.04101167
If latitude = S then the decimal latitude value is set to negative.
If longitude = W then the decimal longitude value is set to negative.
Copy link to clipboard
Copied
I can not state I know how. Years ago I found Photoshop script that seems to do what you want. However it may be using the Camera EXIF meta data which may not be the bridge data you are referring to. I hardly ever use the bridge. I forget what the script originally supported. I may have used a sledge hammer on the script to get it to do what I wanted it to do. I knew almost nothing about JavaScript and Photoshop Scripting back then. I know just a little more these days. I can not say I use the script. But I just downloaded a image of the London Bridge and opened it in Photoshop and ran the script. A browser window opened with Google Map position on the London bridge in Europe not the one in our desert. So it seems like the code may do what you want.
// Open Map from GPS Location.jsx
// Version 1.0
// Shaun Ivory (shaun@ivory.org)
//
// Feel free to modify this script. If you do anything interesting with it,
// please let me know.
// JJMack I just used my sledge hammer on Shaun's Photoshop script
// I sucked in his include file and removed his include statement
// then I commented out his dialog and just Goolge Map the GPS location
/*
<javascriptresource>
<about>$$$/JavaScripts/GoogleMapGPS/About=JJMack's Google Map GPS.^r^rCopyright 2014 Mouseprints.^r^rScript utility for action.^rNOTE:Modified Shaun's Ivory just Google Map GPS location</about>
<category>JJMack's Action Utility</category>
</javascriptresource>
*/
//
// Constants which identify the different mapping sites
//
c_MapWebsites =
[
"google",
"mappoint",
"virtualearth"
];
var c_nDefaultMapWebsiteIndex = 2;
var c_strTemporaryUrlFile = "~/TemporaryPhotoshopMapUrl.url";
var c_strPhotoCaption = "Photo%20Location";
// EXIF constants
c_ExifGpsLatitudeRef = "GPS Latitude Ref"
c_ExifGpsLatitude = "GPS Latitude"
c_ExifGpsLongitudeRef = "GPS Longitude Ref"
c_ExifGpsLongitude = "GPS Longitude"
c_ExifGpsAltitudeRef = "GPS Altitude Ref"
c_ExifGpsAltitude = "GPS Altitude"
c_ExifGpsTimeStamp = "GPS Time Stamp"
c_ExifMake = "Make"
c_ExifModel = "Model"
c_ExifExposureTime = "Exposure Time"
c_ExifAperture = "F-Stop"
c_ExifExposureProgram = "Exposure Program"
c_ExifIsoSpeedRating = "ISO Speed Ratings"
c_ExifDateTimeOriginal = "Date Time Original"
c_ExifMaxApertureValue = "Max Aperture Value"
c_ExifMeteringMode = "Metering Mode"
c_ExifLightSource = "Light Source"
c_ExifFlash = "Flash"
c_ExifFocalLength = "Focal Length"
c_ExifColorSpace = "Color Space"
c_ExifWidth = "Pixel X Dimension"
c_ExifHeight = "Pixel Y Dimension"
function GetRawExifValueIfPresent(strExifValueName)
{
// Empty string means it wasn't found
var strResult = new String("");
// Make sure there is a current document
if (app.documents.length)
{
// Loop through each element in the EXIF properties array
for (nCurrentElement = 0, nCount = 0; nCurrentElement < activeDocument.info.exif.length; ++nCurrentElement)
{
// Get the current element as a string
var strCurrentRecord = new String(activeDocument.info.exif[nCurrentElement]);
// Find the first comma
var nComma = strCurrentRecord.indexOf(",");
if (nComma >= 0)
{
// Everything before the comma is the field name
var strCurrentExifName = strCurrentRecord.substr(0, nComma);
// Is it a valid string?
if (strCurrentExifName.length)
{
// Is this our element?
if (strCurrentExifName == strExifValueName)
{
// Everything after the comma is the value, so
// save it and exit the loop
strResult = strCurrentRecord.substr(nComma + 1);
break;
}
}
}
}
}
return strResult;
}
//
// Convert a Photoshop latitude or longitude, formatted like
// this:
//
// Example: 47.00 38.00' 33.60"
//
// to the decimal form:
//
// Example: 47.642667
//
// It returns an empty string if the string is in an unexpected
// form.
//
function ConvertLatitudeOrLongitudeToDecimal(strLatLong)
{
var nResult = 0.0;
// Copy the input string
var strSource = new String(strLatLong);
// Find the first space
nIndex = strSource.indexOf(" ");
if (nIndex >= 0)
{
// Copy up to the first space
strDegrees = strSource.substr(0, nIndex);
// Skip this part, plus the space
strSource = strSource.substr(nIndex + 1);
// Find the tick mark
nIndex = strSource.indexOf("'");
if (nIndex >= 0)
{
// Copy up to the tick mark
strMinutes = strSource.substr(0, nIndex);
// Skip this chunk, plus the tick and space
strSource = strSource.substr(nIndex + 2);
// Find the seconds mark: "
nIndex = strSource.indexOf("\"");
if (nIndex >= 0)
{
// Copy up to the seconds
strSeconds = strSource.substr(0, nIndex);
// Convert to numbers
var nDegrees = parseFloat(strDegrees);
var nMinutes = parseFloat(strMinutes);
var nSeconds = parseFloat(strSeconds);
// Use the correct symbols
nResult = nDegrees + (nMinutes / 60.0) + (nSeconds / 3600.0);
}
}
}
return nResult;
}
function GetDecimalLatitudeOrLongitude(strExifLatOrLong, strExifLatOrLongRef, strResult)
{
var strResult = "";
// Get the exif values
strLatOrLong = GetRawExifValueIfPresent(strExifLatOrLong);
strLatOrLongRef = GetRawExifValueIfPresent(strExifLatOrLongRef);
// If we were able to read them
if (strLatOrLong.length && strLatOrLongRef.length)
{
// Parse and convert to a decimal
var nResult = ConvertLatitudeOrLongitudeToDecimal(strLatOrLong);
// If we are in the southern or western hemisphere, negate the result
if (strLatOrLongRef[0] == 'S' || strLatOrLongRef[0] == 'W')
{
nResult *= -1;
}
strResult = nResult.toString();
}
return strResult;
}
function CreateGoogleMapsUrl(strLatitude, strLongitude)
{
return "http://maps.google.com/maps?ll=" + strLatitude + "," + strLongitude + "&spn=0.01,0.01";
}
function CreateMappointUrl(strLatitude, strLongitude)
{
return "http://mappoint.msn.com/map.aspx?L=USA&C=" + strLatitude + "%2c" + strLongitude + "&A=50&P=|" + strLatitude + "%2c" + strLongitude + "|39|" + c_strPhotoCaption +"|L1|"
}
function CreateVirtualEarthUrl(strLatitude, strLongitude)
{
return "http://virtualearth.msn.com/default.aspx?v=2&style=h&lvl=17&cp=" + strLatitude + "~" + strLongitude + "&sp=an." + strLatitude + "_" + strLongitude + "_" + c_strPhotoCaption + "_";
}
function CMapSiteSelection()
{
// Initialize default map provider
this.Site = c_MapWebsites[c_nDefaultMapWebsiteIndex];
return this;
}
function ShowMyDialog(strLatitude, strLongitude)
{
// Use the default website
var strCurrentSite = c_MapWebsites[c_nDefaultMapWebsiteIndex];
dlgMain = new Window("dialog", "Choose a Map Website");
// Add the top group
dlgMain.TopGroup = dlgMain.add("group");
dlgMain.TopGroup.orientation = "row";
dlgMain.TopGroup.alignChildren = "top";
dlgMain.TopGroup.alignment = "fill";
// Add the left group
dlgMain.TopGroup.LeftGroup = dlgMain.TopGroup.add("group");
dlgMain.TopGroup.LeftGroup.orientation = "column";
dlgMain.TopGroup.LeftGroup.alignChildren = "left";
dlgMain.TopGroup.LeftGroup.alignment = "fill";
dlgMain.AspectRatioGroup = dlgMain.TopGroup.LeftGroup.add("panel", undefined, "Map Website");
dlgMain.AspectRatioGroup.alignment = "fill";
dlgMain.AspectRatioGroup.orientation = "column";
dlgMain.AspectRatioGroup.alignChildren = "left";
// Add radio buttons
dlgMain.virtualEarth = dlgMain.AspectRatioGroup.add("radiobutton", undefined, "Windows Live Local (aka Virtual Earth)");
dlgMain.virtualEarth.onClick = function virtualEarthOnClick()
{
strCurrentSite = "virtualearth";
}
dlgMain.mappoint = dlgMain.AspectRatioGroup.add("radiobutton", undefined, "MSN Maps && Directions (aka MapPoint)");
dlgMain.mappoint.onClick = function mappointOnClick()
{
strCurrentSite = "mappoint";
}
dlgMain.google = dlgMain.AspectRatioGroup.add("radiobutton", undefined, "Google Local (aka Google Maps)");
dlgMain.google.onClick = function googleOnClick()
{
strCurrentSite = "google";
}
// Set the checked radio button
if (strCurrentSite == "google")
{
dlgMain.google.value = true;
}
else if (strCurrentSite == "mappoint")
{
dlgMain.mappoint.value = true;
}
else
{
dlgMain.virtualEarth.value = true;
}
// Add the button group
dlgMain.TopGroup.RightGroup = dlgMain.TopGroup.add("group");
dlgMain.TopGroup.RightGroup.orientation = "column";
dlgMain.TopGroup.RightGroup.alignChildren = "left";
dlgMain.TopGroup.RightGroup.alignment = "fill";
// Add the buttons
dlgMain.btnOpenSite = dlgMain.TopGroup.RightGroup.add("button", undefined, "Open");
dlgMain.btnClose = dlgMain.TopGroup.RightGroup.add("button", undefined, "Exit");
dlgMain.btnClose.onClick = function()
{
dlgMain.close(true);
}
dlgMain.btnOpenSite.onClick = function()
{
// Which website?
var strUrl = "";
switch (strCurrentSite)
{
case "mappoint":
strUrl = CreateMappointUrl(strLatitude, strLongitude);
break;
case "google":
strUrl = CreateGoogleMapsUrl(strLatitude, strLongitude);
break;
case "virtualearth":
default:
strUrl = CreateVirtualEarthUrl(strLatitude, strLongitude);
break;
}
// Create the URL file and launch it
var fileUrlShortcut = new File(c_strTemporaryUrlFile);
fileUrlShortcut.open('w');
fileUrlShortcut.writeln("[InternetShortcut]")
fileUrlShortcut.writeln("URL=" + strUrl);
fileUrlShortcut.execute();
}
// Set the button characteristics
dlgMain.cancelElement = dlgMain.btnClose;
dlgMain.defaultElement = dlgMain.btnOpenSite;
dlgMain.center();
return dlgMain.show();
}
function GoogleMap(strLatitude, strLongitude)
{
strUrl = CreateGoogleMapsUrl(strLatitude, strLongitude)
try{
var URL = new File(Folder.temp + "/GoogleMapIt.html");
URL.open("w");
URL.writeln('<html><HEAD><meta HTTP-EQUIV="REFRESH" content="0; ' + strUrl + ' "></HEAD></HTML>');
/*
URL.writeln("<!DOCTYPE html>");
URL.writeln("<html><head>");
URL.writeln('<meta name="viewport" content="initial-scale=1.0, user-scalable=no">');
URL.writeln('<meta charset="utf-8">');
URL.writeln("<title>Simple markers</title>");
URL.writeln("<style>html, body, #map-canvas {height: 100%;margin: 0px;padding: 0px}</style>");
URL.writeln('<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script>');
URL.writeln("<script>function initialize() {");
URL.writeln("var myLatlng = new google.maps.LatLng(" + strLatitude +"," + strLongitude + ",true);");
URL.writeln("var mapOptions = {zoom: 15,center: myLatlng,mapTypeId: google.maps.MapTypeId.ROADMAP}");
URL.writeln("var map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions);");
URL.writeln("var marker = new google.maps.Marker({position: myLatlng,map: map,title: 'My Picture Name'});}");
URL.writeln("google.maps.event.addDomListener(window, 'load', initialize);");
URL.writeln('</script></head><body><div id="map-canvas"></div></body></html>');
*/
URL.close();
URL.execute(); // The temp file is created but this fails to open the users default browser using Photoshop CC prior Photoshop versions work
}catch(e){
alert("Error, Can Not Open.");
};
}
function OpenMapUrl()
{
// Get the latitude
var strDecimalLatitude = GetDecimalLatitudeOrLongitude(c_ExifGpsLatitude, c_ExifGpsLatitudeRef);
if (strDecimalLatitude.length)
{
// Get the longitude
var strDecimalLongitude = GetDecimalLatitudeOrLongitude(c_ExifGpsLongitude, c_ExifGpsLongitudeRef);
if (strDecimalLongitude.length)
{
//ShowMyDialog(strDecimalLatitude, strDecimalLongitude);
GoogleMap(strDecimalLatitude, strDecimalLongitude);
}
}
}
function Main()
{
if (app.documents.length > 0)
{
OpenMapUrl();
}
else
{
alert("You don't have an image opened. Please open an image before running this script.");
}
}
Main();
Copy link to clipboard
Copied
Thanks JJMack,
My post was not a question but a statement of how to convert from the Bridge GPS format.
Useful if you want to convert to a standard GPS format.
There are useful scripts for a plugin to show the geolocation of a picture in Bridge (see for instance Adobe_Bridge_Show_Geo_Location).
Probably doing the same thing as you are showing.
It is very nice, I am using it.
But I also want to convert Bridge GPS coordinates to put into my database.
Then you have to do the conversion manually. That's what I meant.
/Larry
Copy link to clipboard
Copied
We're a problem resolution focused bunch here...
/* But I also want to convert Bridge GPS coordinates to put into my database.
Then you have to do the conversion manually. That's what I meant. */
Do you wish to import a batch of data, or is it just manually input into the DB one at a time?
I'm sure a spreadsheet or some online calculator could help streamline the process, or this could be scripted or ExifTool could be used.
ExifTool reports the GPS info from Bridge, which I believe uses the EXIF GPS format as:
[GPS] GPSLatitudeRef : North
[GPS] GPSLatitude : 57 deg 46' 47.40"
[GPS] GPSLongitudeRef : East
[GPS] GPSLongitude : 12 deg 2' 27.64"
The following command can reformat this data:
exiftool -c '%.6f' -GPSPosition 'PATHtoFILEorFOLDER'
Which will output the data as:
GPS Position: 57.779833 N, 12.041012 E
Which should be easier to use and can be output to .txt or .csv for a batch of images.
Copy link to clipboard
Copied
Hi Stephen,
I just wanted to give the formula to read the Bridge GPS coordinate to a standard format.
But. Exiftool is a strong tool once you learn to use it.
Basic problem is that Adobe Bridge uses this format:
[GPS] GPSlatitudeRef: North
[GPS] GPSlatitudeRef: 57,47.758N (Adobe standard)
and NOT:
[GPS] GPSlatitudeRef: 57deg 47’ 44.056” (GPS standard format)
And yes the Exiftool command
exiftool -c '%.6f' -GPSPosition 'PATHtoFILEorFOLDER'
puts out (on the screen, not changing the information in Bridge) like:
======== E:/_Arkive/Jpgs/IMG_6108.jpg
GPS Position : '57.795571' N, '12.048609' E
So with Exiftool you can create a list with standard decimal GPS coordinates for Jpeg images in the specified Bridge folder (that happened to have GPS information), from which list you can cut and paste for instance to a database.
Good if you want to use the GPS coordinate with any Map program that does not read the Adobe standard GPS coordinates (is there any?)
Thanks for the command!
Copy link to clipboard
Copied
No need to convert. Just copy and paste from Bridge to Google Maps and delete the commas, leaving a space. For ex: in Bridge: 37,52.8146N and 25,46.6101W paste it in Google: 37 52.8146N and 25 46.6101W
Copy link to clipboard
Copied
You are a star!
Copy link to clipboard
Copied
Thank you, Bruno. I was about to give up after seeing all those crazy formulas and scripts - and I wouldn't have a clue how to "set the decimal latitude value to negative." Thanks to your solution I can now see where I was in a second...
Copy link to clipboard
Copied
No worries! It took me a while to manage how to do this. I have tried online converters and scripts too... Sometimes I google "how to convert Bridge GPS coordinates" and end up finding my own answer, cause I forget how to do it hahahah I hope they don't delete this topic cause I think this is the only way to do it. Good luck with your workflow. cheers
Copy link to clipboard
Copied
I decided to turn your suggestion into a simple script. Run the script in Photoshop to copy the GPS data to the clipboard, with the comma automatically converted to a space - ready to paste into Google Maps, which saves a few steps!
/*
GPS Metadata to Clipboard Formatted for Google Maps.jsx
https://community.adobe.com/t5/photoshop-ecosystem-discussions/how-to-convert-bridge-gps-coordinates/td-p/10945842
v1.0, 4th January 2023, Stephen Marsh
Special thanks to Bruno.Rodrigues for suggesting the replacement of the comma for a space!
*/
#target photoshop
if (documents.length) {
if (ExternalObject.AdobeXMPScript === undefined) ExternalObject.AdobeXMPScript = new ExternalObject('lib:AdobeXMPScript');
var xmp = new XMPMeta(activeDocument.xmpMetadata.rawData);
var gpsLat = xmp.getProperty("http://ns.adobe.com/exif/1.0/", "GPSLatitude");
var gpsLon = xmp.getProperty("http://ns.adobe.com/exif/1.0/", "GPSLongitude");
// ? gpsAlt ?
// ? gpsDir ?
if (gpsLat !== undefined && gpsLon !== undefined) {
gpsLat = gpsLat.toString().replace(/,/ ' ');
gpsLon = gpsLon.toString().replace(/,/ ' ');
var googleGPS = gpsLat + ", " + gpsLon;
var d = new ActionDescriptor();
d.putString(stringIDToTypeID("textData"), googleGPS);
executeAction(stringIDToTypeID("textToClipboard"), d, DialogModes.NO);
alert(googleGPS + "\r" + "(GPS metadata copied to the clipboard - ready to paste into Google Maps...)");
} else {
alert("The GPS metadata appears to be incomplete or missing...");
}
} else {
alert("A document must be open to run this script!");
}
https://prepression.blogspot.com/2017/11/downloading-and-installing-adobe-scripts.html