@ Nullable public GeoLocation getGeoLocation ( ) { Rational [ ] latitudes = getRationalArray ( TAG_LATITUDE ) ; Rational [ ] longitudes = getRationalArray ( TAG_LONGITUDE ) ; String latitudeRef = getString ( TAG_LATITUDE_REF ) ; String longitudeRef = getString ( TAG_LONGITUDE_REF ) ; // Make sure we have the required values if ( latitudes == null || latitudes . length != 3 ) return null ; if ( longitudes == null || longitudes . length != 3 ) return null ; if ( latitudeRef == null || longitudeRef == null ) return null ; Double lat = GeoLocation . degreesMinutesSecondsToDecimal ( latitudes [ 0 ] , latitudes [ 1 ] , latitudes [ 2 ] , latitudeRef . equalsIgnoreCase ( "S" ) ) ; Double lon = GeoLocation . degreesMinutesSecondsToDecimal ( longitudes [ 0 ] , longitudes [ 1 ] , longitudes [ 2 ] , longitudeRef . equalsIgnoreCase ( "W" ) ) ; // This can return null, in cases where the conversion was not possible if ( lat == null || lon == null ) return null ; return new GeoLocation ( lat , lon ) ; }
Parses various tags in an attempt to obtain a single object representing the latitude and longitude at which this image was captured .