Tags: patch
I finally got around to doing this myself - please consider adding or
upstreaming this patch:
diff -r -u gpscorrelate-1.6.1/correlate.c gpscorrelate-1.6.1+tms.1/correlate.c
--- gpscorrelate-1.6.1/correlate.c 2007-06-21 15:31:49.0 +0100
+++ gpscorrelate-1.6.1+tms.1/correlate.c 2013-04-26 09:45:25.464853539 +0100
@@ -60,7 +60,7 @@
Options-Result = CORR_NOEXIFINPUT;
return 0;
}
- if (IncludesGPS)
+ if (IncludesGPS !Options-OverwriteExisting)
{
/* Already have GPS data in the file!
* So we can't do this again... */
diff -r -u gpscorrelate-1.6.1/correlate.h gpscorrelate-1.6.1+tms.1/correlate.h
--- gpscorrelate-1.6.1/correlate.h 2007-06-21 15:31:49.0 +0100
+++ gpscorrelate-1.6.1+tms.1/correlate.h 2013-04-26 09:44:12.656247487 +0100
@@ -29,6 +29,7 @@
* Not really sure if this is needed, but... */
struct CorrelateOptions {
int NoWriteExif;
+ int OverwriteExisting;
int NoInterpolate;
int NoChangeMtime;
int TimeZoneHours; /* To add to photos to make them UTC. */
diff -r -u gpscorrelate-1.6.1/debian/changelog gpscorrelate-1.6.1+tms.1/debian/changelog
--- gpscorrelate-1.6.1/debian/changelog 2012-05-06 23:28:10.0 +0100
+++ gpscorrelate-1.6.1+tms.1/debian/changelog 2013-04-26 10:30:33.559152896 +0100
@@ -1,3 +1,9 @@
+gpscorrelate (1.6.1-4+tms.1) unstable; urgency=low
+
+ * Add ability to force overwriting of existing tags
+
+ -- Toby Speight t.m.speight...@cantab.net Fri, 26 Apr 2013 09:31:14 +0100
+
gpscorrelate (1.6.1-4) unstable; urgency=low
* Update Maintainer field with Debian email.
diff -r -u gpscorrelate-1.6.1/doc/command.html gpscorrelate-1.6.1+tms.1/doc/command.html
--- gpscorrelate-1.6.1/doc/command.html 2007-06-21 15:31:49.0 +0100
+++ gpscorrelate-1.6.1+tms.1/doc/command.html 2013-04-26 10:14:59.547518455 +0100
@@ -54,6 +54,13 @@
tr
td valign=top nowrap=nowrap
+b--force or -F/b
+/tdtd
+Overwrite any existing GPS EXIF tags in the file. Without this option, image files that already have GPS tags are not modified. Setting this option will never cause tags to be removed; use -r for that.
+/td/tr
+
+tr
+td valign=top nowrap=nowrap
b--datum or -d datum/b
/tdtd
Specifies the datum to write into the GPS EXIF tags. By default, it is WGS-84. However, GPX is not supposed to store anything but WGS-84, so use if you must.
diff -r -u gpscorrelate-1.6.1/doc/gpscorrelate-manpage.xml.in gpscorrelate-1.6.1+tms.1/doc/gpscorrelate-manpage.xml.in
--- gpscorrelate-1.6.1/doc/gpscorrelate-manpage.xml.in 2008-10-31 11:50:39.0 +
+++ gpscorrelate-1.6.1+tms.1/doc/gpscorrelate-manpage.xml.in 2013-04-26 09:56:46.094513109 +0100
@@ -77,6 +77,11 @@
arg choice=plain-n/arg
arg choice=plain--no-write/arg
/group
+
+ group
+arg choice=plain-F/arg
+arg choice=plain--force/arg
+ /group
group
arg choice=plain-m/arg
@@ -297,6 +302,16 @@
/listitem
/varlistentry
+ varlistentry
+term
+ option-F/option,
+ option--force/option
+/term
+listitem
+ paraoverwrite existing GPS tags/para
+/listitem
+ /varlistentry
+
varlistentry
term
option-m/option,
diff -r -u gpscorrelate-1.6.1/doc/gui.html gpscorrelate-1.6.1+tms.1/doc/gui.html
--- gpscorrelate-1.6.1/doc/gui.html 2007-06-21 15:31:49.0 +0100
+++ gpscorrelate-1.6.1+tms.1/doc/gui.html 2013-04-26 10:13:34.086815903 +0100
@@ -28,6 +28,8 @@
pThe bDon't write/b checkbox, if checked, will prevent the GPS EXIF tags being written back to the photo. However, the point that is matched will be shown in the list, which allows you to correlate and check the results first./p
+pThe bOverwrite existing tags/b checkbox, if checked, will make matches replace any existing tags. Without this option, files that already have GPS tags will not be touched. Unmatched files will not be modified, regardless of this setting./p
+
pThe bDon't change mtime/b checkbox, if checked, will prevent changes to the JPEG files from updating the files mtime./p
pThe bBetween Segments/b checkbox, if checked, will ignore track segments, and match photos between track segments. Usually a track segment differentiates between multiple GPS data logging sessions, so interpolating between track segments could well be interpolating when there was no GPS data./p
diff -r -u gpscorrelate-1.6.1/exif-gps.cpp gpscorrelate-1.6.1+tms.1/exif-gps.cpp
--- gpscorrelate-1.6.1/exif-gps.cpp 2013-05-02 17:44:42.0 +0100
+++ gpscorrelate-1.6.1+tms.1/exif-gps.cpp 2013-04-26 11:02:11.142842258 +0100
@@ -434,6 +434,15 @@
}
+void replace(Exiv2::ExifData exif, Exiv2::ExifKey key, const Exiv2::Value *value)
+{
+Exiv2::ExifData::iterator it = exif.findKey(key);
+if (it != exif.end())
+it-setValue(value);
+else
+exif.add(key, value);
+}
+
int WriteGPSData(char* File, struct GPSPoint* Point, char* Datum, int NoChangeMtime, int