Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve printing of GPS info #1551

Merged
merged 3 commits into from
Apr 14, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 18 additions & 18 deletions src/tags_int.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2117,14 +2117,14 @@ namespace Exiv2 {

//! GPS status, tag 0x0009
extern const TagDetails exifGPSStatus[] = {
{ 'A', N_("Measurement in progress") },
{ 'V', N_("Measurement Interoperability") }
{ 'A', N_("Measurement in progress") },
{ 'V', N_("Measurement interrupted") }
};

//! GPS measurement mode, tag 0x000a
extern const TagDetails exifGPSMeasureMode[] = {
{ '2', N_("Two-dimensional measurement") },
{ '3', N_("Three-dimensional measurement") }
{ '2', N_("2-dimensional measurement") },
{ '3', N_("3-dimensional measurement") }
};

//! GPS speed reference, tag 0x000c
Expand All @@ -2134,20 +2134,20 @@ namespace Exiv2 {
{ 'N', N_("knots") }
};

//! GPS direction ref, tags 0x000e, 0x0010, 0x0017
//! GPS direction reference, tags 0x000e, 0x0010, 0x0017
extern const TagDetails exifGPSDirRef[] = {
{ 'T', N_("True direction") },
{ 'M', N_("Magnetic direction") }
};

//! GPS Destination distance ref, tag 0x0019
//! GPS destination distance reference, tag 0x0019
extern const TagDetails exifGPSDestDistanceRef[] = {
{ 'K', N_("Kilometers") },
{ 'M', N_("Miles") },
{ 'N', N_("Knots") }
{ 'K', N_("km") },
{ 'M', N_("miles") },
{ 'N', N_("nautical miles") }
};

//! GPS Differential, tag 0x001e
//! GPS differential correction, tag 0x001e
extern const TagDetails exifGPSDifferential[] = {
{ 0, N_("Without correction") },
{ 1, N_("Correction applied") }
Expand Down Expand Up @@ -2222,30 +2222,30 @@ namespace Exiv2 {
TagInfo(0x000b, "GPSDOP", N_("GPS Data Degree of Precision"),
N_("Indicates the GPS DOP (data degree of precision). An HDOP value is written "
"during two-dimensional measurement, and PDOP during three-dimensional measurement."),
gpsId, gpsTags, unsignedRational, 1, printValue),
gpsId, gpsTags, unsignedRational, 1, printFloat),
TagInfo(0x000c, "GPSSpeedRef", N_("GPS Speed Reference"),
N_("Indicates the unit used to express the GPS receiver speed of movement. "
"\"K\" \"M\" and \"N\" represents kilometers per hour, miles per hour, and knots."),
gpsId, gpsTags, asciiString, 2, print0x000c),
TagInfo(0x000d, "GPSSpeed", N_("GPS Speed"),
N_("Indicates the speed of GPS receiver movement."),
gpsId, gpsTags, unsignedRational, 1, printValue),
gpsId, gpsTags, unsignedRational, 1, printFloat),
TagInfo(0x000e, "GPSTrackRef", N_("GPS Track Ref"),
N_("Indicates the reference for giving the direction of GPS receiver movement. "
"\"T\" denotes true direction and \"M\" is magnetic direction."),
gpsId, gpsTags, asciiString, 2, printGPSDirRef),
TagInfo(0x000f, "GPSTrack", N_("GPS Track"),
N_("Indicates the direction of GPS receiver movement. The range of values is "
"from 0.00 to 359.99."),
gpsId, gpsTags, unsignedRational, 1, printValue),
gpsId, gpsTags, unsignedRational, 1, printFloat),
TagInfo(0x0010, "GPSImgDirectionRef", N_("GPS Image Direction Reference"),
N_("Indicates the reference for giving the direction of the image when it is captured. "
"\"T\" denotes true direction and \"M\" is magnetic direction."),
gpsId, gpsTags, asciiString, 2, printGPSDirRef),
TagInfo(0x0011, "GPSImgDirection", N_("GPS Image Direction"),
N_("Indicates the direction of the image when it was captured. The range of values "
"is from 0.00 to 359.99."),
gpsId, gpsTags, unsignedRational, 1, printValue),
gpsId, gpsTags, unsignedRational, 1, printFloat),
TagInfo(0x0012, "GPSMapDatum", N_("GPS Map Datum"),
N_("Indicates the geodetic survey data used by the GPS receiver. If the survey data "
"is restricted to Japan, the value of this tag is \"TOKYO\" or \"WGS-84\"."),
Expand Down Expand Up @@ -2280,14 +2280,14 @@ namespace Exiv2 {
TagInfo(0x0018, "GPSDestBearing", N_("GPS Destination Bearing"),
N_("Indicates the bearing to the destination point. The range of values is from "
"0.00 to 359.99."),
gpsId, gpsTags, unsignedRational, 1, printValue),
gpsId, gpsTags, unsignedRational, 1, printFloat),
TagInfo(0x0019, "GPSDestDistanceRef", N_("GPS Destination Distance Reference"),
N_("Indicates the unit used to express the distance to the destination point. "
"\"K\", \"M\" and \"N\" represent kilometers, miles and knots."),
gpsId, gpsTags, asciiString, 2, print0x0019),
TagInfo(0x001a, "GPSDestDistance", N_("GPS Destination Distance"),
N_("Indicates the distance to the destination point."),
gpsId, gpsTags, unsignedRational, 1, printValue),
gpsId, gpsTags, unsignedRational, 1, printFloat),
TagInfo(0x001b, "GPSProcessingMethod", N_("GPS Processing Method"),
N_("A character string recording the name of the method used for location finding. "
"The string encoding is defined using the same scheme as UserComment."),
Expand All @@ -2305,7 +2305,7 @@ namespace Exiv2 {
gpsId, gpsTags, unsignedShort, 1, print0x001e),
TagInfo(0x001f, "GPSHPositioningError", N_("GPS Horizontal positioning error"),
N_("This tag indicates horizontal positioning errors in meters."),
gpsId, gpsTags, unsignedRational, 1, printValue),
gpsId, gpsTags, unsignedRational, 1, printFloat),
// End of list marker
TagInfo(0xffff, "(UnknownGpsTag)", N_("Unknown GPSInfo tag"),
N_("Unknown GPSInfo tag"),
Expand Down Expand Up @@ -2625,7 +2625,7 @@ namespace Exiv2 {
{
std::ios::fmtflags f( os.flags() );
if (value.count() == 3) {
static const char* unit[] = { "deg", "'", "\"" };
static const char* unit[] = { " deg", "'", "\"" };
for (int i = 0; i < value.count() ; ++i) {
const int v = (int) (value.toFloat(i)+0.5f); // nearest integer
os << (i != 0? " " : "") << v << unit[i];
Expand Down
8 changes: 4 additions & 4 deletions test/data/geotag-test.out
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
--- show GPSInfo tags ---
Exif.GPSInfo.GPSVersionID Byte 4 2.2.0.0
Exif.GPSInfo.GPSLatitudeRef Ascii 2 North
Exif.GPSInfo.GPSLatitude Rational 3 36deg 26' 54"
Exif.GPSInfo.GPSLatitude Rational 3 36 deg 26' 54"
Exif.GPSInfo.GPSLongitudeRef Ascii 2 West
Exif.GPSInfo.GPSLongitude Rational 3 116deg 51' 18"
Exif.GPSInfo.GPSLongitude Rational 3 116 deg 51' 18"
Exif.GPSInfo.GPSAltitudeRef Byte 1 Below sea level
Exif.GPSInfo.GPSAltitude Rational 1 14.3 m
Exif.GPSInfo.GPSTimeStamp Rational 3 09:54:28
Expand All @@ -16,9 +16,9 @@ Exif.GPSInfo.GPSDateStamp Ascii 20 2008:05:08 09:54:28
--- show GPSInfo tags ---
Exif.GPSInfo.GPSVersionID Byte 4 2.2.0.0
Exif.GPSInfo.GPSLatitudeRef Ascii 2 North
Exif.GPSInfo.GPSLatitude Rational 3 36deg 26' 54"
Exif.GPSInfo.GPSLatitude Rational 3 36 deg 26' 54"
Exif.GPSInfo.GPSLongitudeRef Ascii 2 West
Exif.GPSInfo.GPSLongitude Rational 3 116deg 51' 18"
Exif.GPSInfo.GPSLongitude Rational 3 116 deg 51' 18"
Exif.GPSInfo.GPSAltitudeRef Byte 1 Below sea level
Exif.GPSInfo.GPSAltitude Rational 1 14.3 m
Exif.GPSInfo.GPSTimeStamp Rational 3 09:54:28
Expand Down
4 changes: 2 additions & 2 deletions tests/bugfixes/github/test_issue_1046.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ class test_issue_1046Test(metaclass=CaseMeta):
stdout = ["""Exif.Photo.UserComment Undefined 12 charset=Unicode AB
Exif.GPSInfo.GPSVersionID Byte 4 2.2.0.0
Exif.GPSInfo.GPSLatitudeRef Ascii 2 North
Exif.GPSInfo.GPSLatitude Rational 3 51deg 23' 13"
Exif.GPSInfo.GPSLatitude Rational 3 51 deg 23' 13"
Exif.GPSInfo.GPSLongitudeRef Ascii 2 West
Exif.GPSInfo.GPSLongitude Rational 3 0deg 44' 27"
Exif.GPSInfo.GPSLongitude Rational 3 0 deg 44' 27"
Exif.GPSInfo.GPSAltitudeRef Byte 1 Above sea level
Exif.GPSInfo.GPSAltitude Rational 1 104.2 m
Exif.GPSInfo.GPSTimeStamp Rational 3 10:34:11
Expand Down
4 changes: 2 additions & 2 deletions tests/bugfixes/redmine/test_issue_1024.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ class CheckRegularExpressionSupport(metaclass=system_tests.CaseMeta):
commands = [ "$exiv2 -pa --grep gpsl/i $filename" ]

stdout = [ """Exif.GPSInfo.GPSLatitudeRef Ascii 2 North
Exif.GPSInfo.GPSLatitude Rational 3 52deg 4' 0"
Exif.GPSInfo.GPSLatitude Rational 3 52 deg 4' 0"
Exif.GPSInfo.GPSLongitudeRef Ascii 2 East
Exif.GPSInfo.GPSLongitude Rational 3 1deg 14' 0"
Exif.GPSInfo.GPSLongitude Rational 3 1 deg 14' 0"
"""
]
stderr = [""]
Expand Down
4 changes: 2 additions & 2 deletions tests/bugfixes/redmine/test_issue_1137.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ class MetadataPiping(metaclass=system_tests.CaseMeta):
output_grep_GPSL,
"",
"""Exif.GPSInfo.GPSLatitudeRef Ascii 2 North
Exif.GPSInfo.GPSLatitude Rational 3 51deg 11' 0"
Exif.GPSInfo.GPSLatitude Rational 3 51 deg 11' 0"
Exif.GPSInfo.GPSLongitudeRef Ascii 2 West
Exif.GPSInfo.GPSLongitude Rational 3 1deg 50' 0"
Exif.GPSInfo.GPSLongitude Rational 3 1 deg 50' 0"
"""
]
4 changes: 2 additions & 2 deletions tests/bugfixes/redmine/test_issue_528.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ class TypeSizeForExifOnly(metaclass=system_tests.CaseMeta):
Exif.Image.GPSTag Long 1 870
Exif.GPSInfo.GPSVersionID Byte 4 2.0.0.0
Exif.GPSInfo.GPSLatitudeRef Ascii 2 North
Exif.GPSInfo.GPSLatitude Rational 3 47deg 36' 58"
Exif.GPSInfo.GPSLatitude Rational 3 47 deg 36' 58"
Exif.GPSInfo.GPSLongitudeRef Ascii 2 East
Exif.GPSInfo.GPSLongitude Rational 3 1deg 31' 1"
Exif.GPSInfo.GPSLongitude Rational 3 1 deg 31' 1"
Exif.GPSInfo.GPSAltitudeRef Byte 1 Above sea level
Exif.GPSInfo.GPSAltitude Rational 1 86 m
Exif.Thumbnail.Compression Short 1 JPEG (old-style)
Expand Down