[tracker] Writeback N/E/S/W notation for GPS coordinates
- From: Philip Van Hoof <pvanhoof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker] Writeback N/E/S/W notation for GPS coordinates
- Date: Tue, 15 Nov 2011 12:45:50 +0000 (UTC)
commit 789cc72e0333c280583089de6a1e0099ebbf9060
Author: Philip Van Hoof <philip codeminded be>
Date: Tue Nov 15 13:41:27 2011 +0100
Writeback N/E/S/W notation for GPS coordinates
Fixes NB#291088.
src/tracker-writeback/tracker-writeback-xmp.c | 30 +++++++++++++++++++++++-
1 files changed, 28 insertions(+), 2 deletions(-)
---
diff --git a/src/tracker-writeback/tracker-writeback-xmp.c b/src/tracker-writeback/tracker-writeback-xmp.c
index c3e3ed8..1b91b2e 100644
--- a/src/tracker-writeback/tracker-writeback-xmp.c
+++ b/src/tracker-writeback/tracker-writeback-xmp.c
@@ -501,12 +501,38 @@ writeback_xmp_update_file_metadata (TrackerWritebackFile *wbf,
xmp_delete_property (xmp, NS_EXIF, "GPSLongitude");
if (longitude != NULL) {
- xmp_set_property (xmp, NS_EXIF, "GPSLongitude", longitude, 0);
+ double coord = atof (longitude);
+ double degrees, minutes;
+ gchar *val;
+
+ minutes = modf (coord, °rees);
+
+ val = g_strdup_printf ("%3d,%f%c",
+ (int) fabs(degrees),
+ minutes,
+ coord >= 0 ? 'E' : 'W');
+
+ xmp_set_property (xmp, NS_EXIF, "GPSLongitude", val, 0);
+
+ g_free (val);
}
xmp_delete_property (xmp, NS_EXIF, "GPSLatitude");
if (latitude != NULL) {
- xmp_set_property (xmp, NS_EXIF, "GPSLatitude", latitude, 0);
+ double coord = atof (latitude);
+ double degrees, minutes;
+ gchar *val;
+
+ minutes = modf (coord, °rees);
+
+ val = g_strdup_printf ("%3d,%f%c",
+ (int) fabs(degrees),
+ minutes,
+ coord >= 0 ? 'N' : 'S');
+
+ xmp_set_property (xmp, NS_EXIF, "GPSLatitude", val, 0);
+
+ g_free (val);
}
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]