Copy link to clipboard
Copied
Hello,
I'm doing this for private work and wanted to know how to get the gps data from the image that i took and either watermark it or stamp it on the photo. So that if myself or my coworkers can input that datat and find out where the image location .
Copy link to clipboard
Copied
You can find the GPS data by going to File > File Info... and going to the GPS Data section. The coordinates appear under Camera Location.
Copy link to clipboard
Copied
thank you, I did find that information out but I was wondering if there was a way to past that info onto the photo. As a water mark or something along those lines. It won't let me copy and past the data when i try to.
Copy link to clipboard
Copied
This should be scriptable, but getting the gps cords is easier said than done!
Copy link to clipboard
Copied
You can go into Bridge where the GPS metadata can be edited and copied from the Metadata Panel.
Some programs and websites can actually read the GPS metadata and geo-locate for you on a map, saving the extra work.
Copy link to clipboard
Copied
Hers is a very old Script I found on the web that I hammered on for all did not see to work. You may be able to see the code that gets at the geotag data. "GoogleMapGPS.jsx"
// 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);
//alert(strLatOrLong, strLatOrLongRef);
// 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();
//alert(strLatOrLong + " " + strLatOrLongRef + " = " + strResult );
}
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
Als0 found this thread here. Paul script search function needs a couple of
[a]
added
Fron Paul's Code
#target photoshop
if(documents.length) app.activeDocument.suspendHistory('GPS', 'main()');
function main(){
var gpsversion = getExifString('GPS Version');
var longitude = getExifString('GPS Longitude').toString().replace(/0\.00"$/,'').replace(/\.00/g,'');
var longRef = getExifString('GPS Longitude Ref');
var latitude = getExifString('GPS Latitude').toString().replace(/0\.00"$/,'').replace(/\.00/g,'');
var latRef = getExifString('GPS Latitude Ref');
var altitude = getExifString('GPS Altitude').toString().replace(/0\.00"$/,'').replace(/\.00/g,'');
var altRef = getExifString('GPS Altitude Ref');
if (altRef == 'GPS Altitude Ref Not known') altRef = "";
alert("GPS Version: " + gpsversion + "\nLatitude: " + latRef + " " + latitude + "\nLongitude: " + longRef + " " + longitude + "\nAltitude: " + altRef + " " + altitude);
alert(getExifData());
};
function getExifString(searchString) {
var exifArray = activeDocument.info.exif;
for(var a in exifArray){
if(exifArray[a][0].toString() == searchString){
return exifArray[a][1];
}
}
return searchString + ' Not known';
};
function getExifData() {
data = "";
var exifArray = activeDocument.info.exif;
for(var a in exifArray){
data = data + exifArray[a][0].toString() + ": " + exifArray[a][1] + "\n";
}
return data;
};