&& gpsLongitudeRefField != null
&& gpsLongitudeField != null)
{
// all of these values are strings.
String gpsLatitudeRef = (String) gpsLatitudeRefField.getValue();
RationalNumber gpsLatitude[] = (RationalNumber[]) (gpsLatitudeField
.getValue());
String gpsLongitudeRef = (String) gpsLongitudeRefField
.getValue();
RationalNumber gpsLongitude[] = (RationalNumber[]) gpsLongitudeField
.getValue();
RationalNumber gpsLatitudeDegrees = gpsLatitude[0];
RationalNumber gpsLatitudeMinutes = gpsLatitude[1];
RationalNumber gpsLatitudeSeconds = gpsLatitude[2];
RationalNumber gpsLongitudeDegrees = gpsLongitude[0];
RationalNumber gpsLongitudeMinutes = gpsLongitude[1];
RationalNumber gpsLongitudeSeconds = gpsLongitude[2];
// This will format the gps info like so:
//
// gpsLatitude: 8 degrees, 40 minutes, 42.2 seconds S
// gpsLongitude: 115 degrees, 26 minutes, 21.8 seconds E
System.out.println(" " + "GPS Latitude: "
+ gpsLatitudeDegrees.toDisplayString() + " degrees, "
+ gpsLatitudeMinutes.toDisplayString() + " minutes, "
+ gpsLatitudeSeconds.toDisplayString() + " seconds "
+ gpsLatitudeRef);
System.out.println(" " + "GPS Longitude: "
+ gpsLongitudeDegrees.toDisplayString() + " degrees, "
+ gpsLongitudeMinutes.toDisplayString() + " minutes, "
+ gpsLongitudeSeconds.toDisplayString() + " seconds "
+ gpsLongitudeRef);
}
System.out.println();