Be careful, you might be entered into the German DAU awards 2020
Here are three quick scripts that copy (from the first selected file), show (in the logs) and paste (to all selected files) GPS coordinates. To see the currently available data in the status bar use this code: {var:glob:gpsStatusBar}
.
Copy GPS
function OnClick(clickData) {
var cmd = clickData.func.command;
var tab = clickData.func.sourcetab;
cmd.deselect = false;
if (tab.selected_files.count == 0) return;
var fileMeta = tab.selected_files(0).metadata;
if (fileMeta != 'image') return;
var lat = fileMeta.image.latitude;
var lon = fileMeta.image.longitude;
var alt = fileMeta.image.altitude;
if (typeof lat != 'number') lat = 0;
if (typeof lon != 'number') lon = 0;
if (typeof alt != 'number') alt = 0;
DOpus.Vars.Set('lat') = lat;
DOpus.Vars.Set('lon') = lon;
DOpus.Vars.Set('alt') = alt;
DOpus.Vars.Set('gpsStatusBar') = lat.toFixed(1) + '/' + lon.toFixed(1) + '/' + alt.toFixed(1); // {var:glob:gpsStatusBar}
}
Show GPS
function OnClick(clickData) {
var cmd = clickData.func.command;
cmd.RunCommand('Set UTILITY=otherlog');
DOpus.ClearOutput();
DOpus.Output('lat: ' + DOpus.Vars.Get('lat'));
DOpus.Output('lon: ' + DOpus.Vars.Get('lon'));
DOpus.Output('alt: ' + DOpus.Vars.Get('alt'));
DOpus.Output('gpsStatusBar: ' + DOpus.Vars.Get('gpsStatusBar'));
}
Paste GPS
function OnClick(clickData) {
var cmd = clickData.func.command;
cmd.deselect = false;
var lat = DOpus.Vars.Get('lat');
var lon = DOpus.Vars.Get('lon');
var alt = DOpus.Vars.Get('alt');
if (typeof lat != 'number') lat = 0;
if (typeof lon != 'number') lon = 0;
if (typeof alt != 'number') alt = 0;
cmd.RunCommand('SetAttr META gpslatitude:' + lat + ' gpslongitude:' + lon + ' gpsaltitude:' + alt);
}
Copy GPS.dcf (1.7 KB)
Show GPS.dcf (989 Bytes)
Paste GPS.dcf (1.1 KB)