This is a documentation post for my own record on how I will produce a map of 180 date points that I have collected so far. To be honest I’m not a real programmer or anything like that, so the methods used in this post might be desultory or silly. I’m helplessly flapping about here. I’d be happy to hear of what method others would use! But in the absence of any external assistance……..
So the situation thus far is that all the images I have taken have been geotagged by default in iPhone 4, and I want to pull the metadata out into csv (comma separated values) and then bring into something like TileMill where I can produce a proper map of it all.
But first, the drudgery. I needed to batch export the filenames and gps data from all my images. Unfortunately there was no instant readymade solution for this online that I could immediately find. Like with Illustrator and Flash’s automation scripts, what I ended having to do was to write a simple Adobe Bridge script to export all the information…
To find the location for your Bridge scripts, go to Preferences > Click on “Reveal My Startup Scripts” to see the folder in Finder. I found a script on a forum and adapted it slightly (quick and dirty) to include the GPS data. Save it as a .jsx file and drop it into the Startup Scripts folder. Because Bridge is silly, you will have to close and reopen Bridge in order for the script to load – apparently you can’t load it on the fly while Bridge is open. With this script, a new menu item will appear under tools: “Export CSV file”
For some reason, iPhone’s geodata is formatted in degrees:minutes:seconds rather than decimal degrees, and on top of that – confusingly º (degree) is replaced by comma and minutes by full stop, e.g:
48,49.8N 2,22.13E
I wonder why that is so by default. I suppose I understand it but let me tell you if you just plug this into TileMill it wont be read because of the wrong delimiters and I suspect it also requires decimal degrees (DD) instead of degrees-minutes-seconds (DMS). Cue the furious googling of “HOW DOES I CONVERT DMS TO DD?”
Anyway back to the batch exporting of metadata to Excel. The data is saved in different namespaces such as the “exif” and “photoshop” data. EXIF stands for Exchangeable image file format and this is the format for the storage of metadata in files such as images and also audio files. You need to invoke the right namespace to find the right property. For example I realised that the Date Created in both exif and photoshop are different because only files that have been edited within photoshop have got a Date Created stamp (do note the property names also differ slightly in syntax although they may describe similar types of properties).
I eventually figured out which namespace the gps data resided in (EXIF). I don’t know why it isn’t more straightforward to find a reference for all these things. Anyway since we are on the topic, this is a list of standard Namespaces; from these different namespaces you can search for the properties you are looking for so you can call them up:
IPTC Core: http://iptc.org/std/Iptc4xmpCore/1.0/xmlns/ (“Iptc4xmpCore”)
EXIF: http://ns.adobe.com/exif/1.0/ (“exif”);
Dublin Core: http://purl.org/dc/elements/1.1/ (“dc”)
TIFF: http://ns.adobe.com/tiff/1.0/ (“tiff”)
XMP Basic: http://ns.adobe.com/xap/1.0/ (“xmp”)
XMP Media Management: http://ns.adobe.com/xap/1.0/mm/ (“xmpMM”)
XMP Rights Management: http://ns.adobe.com/xap/1.0/rights/ (“xmpRights”)
XMP Basic Job Ticket: http://ns.adobe.com/xap/1.0/bj/ (“xmpBJ”)
XMP Paged-Text: http://ns.adobe.com/xap/1.0/t/pg/ (“xmpTPg”)
Photoshop: http://ns.adobe.com/photoshop/1.0/ (“photoshop”)
Stock Photo: http://ns.adobe.com/StockPhoto/1.0/ (“bmsp”)
Adobe PDF: http://ns.adobe.com/pdf/1.3/ (“pdf”)
Camera Raw Settings: http://ns.adobe.com/camera-raw-settings/1.0/ (“crs”)
PNG: http://ns.adobe.com/png/1.0/ (“png” )
AND VERY IMPORTANT: Reference list of properties for the above schemas
#target bridge
if (BridgeTalk.appName == “bridge” ) {
var menu = MenuElement.create( “command”, “Export CSV File”, “at the end of Tools”);
menu.onSelect = function(m) {
try {
var tDate = new Date();
var tDay = parseInt(tDate.getMonth()+1)+’/’+tDate.getDate()+’/’+tDate.getFullYear();
var f = File.saveDialog(“Export file list to:”, “Comma delimited file:*.CSV”);
if ( !f ) { return; }
f.open(“w”);
f.writeln(“DateProcessed,FileName,DateCreated,ImageWidth,ImageHeight,Latitude,Latitude2,Longitude,Longitude2,Altitude,ImageDirection”);
var items = app.document.visibleThumbnails;
for (var i = 0; i < items.length; ++i) {
var item = items[i];
f.writeln(tDay,’,’,item.name,’,’,ListMetadata(item) );
};
f.close();
} catch(e) {}
};
};
function ListMetadata(tn) {
md = tn.metadata;
md.namespace = “http://ns.adobe.com/xap/1.0/”;
var res = md.CreateDate;
md.namespace = “http://ns.adobe.com/tiff/1.0/”;
res = res + ‘,’ + md.ImageWidth + ‘,’ + md.ImageLength;
md.namespace = “http://ns.adobe.com/exif/1.0/”;
res = res + ‘,’ + md.GPSLatitude + ‘,’ + md.GPSLongitude + ‘,’ + md.GPSAltitude + ‘,’ + md.GPSImgDirection ;
return res;
}