Class LocationReader

Object
LocationReader

public class LocationReader extends Object
Reads the GPS location from EXIF metadata, if specified in an image-file.
Author:
Owen Feehan
  • Method Details

    • readLocation

      public static Optional<ImageLocation> readLocation(Path path) throws ImageIOException
      Reads the image-location from geolocation metadata-tags, if they are present in an image.

      If more than one GpsDirectory exists in the metadata, the first encountered is returned. This is assumed to be an extremely rare (possibly illegal) state.

      Parameters:
      path - the path to the image that may or may not contain geolocation metadata.
      Returns:
      the image-location, iff it can be determined.
      Throws:
      ImageIOException - if the metadata cannot be read.
    • readLocation

      public static Optional<ImageLocation> readLocation(com.drew.metadata.Metadata metadata)
      Reads the image-location from geolocation metadata-tags, if they are present in the metadata.

      If more than one GpsDirectory exists in the metadata, the first encountered is returned. This is assumed to be an extremely rare (possibly illegal) state.

      Parameters:
      metadata - the metadata to read from.
      Returns:
      the image-location, iff it exists in the metadata.