public GPSInfo getGPS() throws ImageReadException
    {
        TiffDirectory gpsDirectory = findDirectory(DIRECTORY_TYPE_GPS);
        if (null == gpsDirectory)
            return null;

        // more specific example of how to access GPS values.
        TiffField latitudeRefField = gpsDirectory
                .findField(TiffConstants.GPS_TAG_GPS_LATITUDE_REF);
        TiffField latitudeField = gpsDirectory
                .findField(TiffConstants.GPS_TAG_GPS_LATITUDE);
        TiffField longitudeRefField = gpsDirectory
                .findField(TiffConstants.GPS_TAG_GPS_LONGITUDE_REF);
        TiffField longitudeField = gpsDirectory
                .findField(TiffConstants.GPS_TAG_GPS_LONGITUDE);

        if (latitudeRefField == null || latitudeField == null
                || longitudeRefField == null || longitudeField == null)
            return null;

        // all of these values are strings.
        String latitudeRef = latitudeRefField.getStringValue();
        RationalNumber latitude[] = (RationalNumber[]) latitudeField.getValue();
        String longitudeRef = longitudeRefField.getStringValue();
        RationalNumber longitude[] = (RationalNumber[]) longitudeField
                .getValue();

        if (latitude.length != 3 || longitude.length != 3)
            throw new ImageReadException(
                    "Expected three values for latitude and longitude.");

        RationalNumber latitudeDegrees = latitude[0];
        RationalNumber latitudeMinutes = latitude[1];
        RationalNumber latitudeSeconds = latitude[2];

        RationalNumber longitudeDegrees = longitude[0];
        RationalNumber longitudeMinutes = longitude[1];
        RationalNumber longitudeSeconds = longitude[2];

        return new GPSInfo(latitudeRef, longitudeRef, latitudeDegrees,
                latitudeMinutes, latitudeSeconds, longitudeDegrees,
                longitudeMinutes, longitudeSeconds);
    }