0

Hi I'm trying to extract geotagged image data using java. But it's not working as expected. I added my code below.

try {

        File file = new File("/home/xxx/Downloads/accidentImage");

        for (File filelist : file.listFiles()) {

        Metadata metadata = ImageMetadataReader.readMetadata(filelist);
        ExifSubIFDDirectory directory
                    = metadata.getDirectory(ExifSubIFDDirectory.class);
            Date date
                    = directory.getDate(ExifSubIFDDirectory.TAG_DATETIME_ORIGINAL);
            GpsDirectory gpsDirectory = metadata.getDirectory(GpsDirectory.class);
            GeoLocation geoLocation = gpsDirectory.getGeoLocation();
            double lat = geoLocation.getLatitude();
            double lon = geoLocation.getLongitude();

        }

    } catch (Exception e) {
        e.printStackTrace();
    }
Codrun
  • 97
  • 2
  • 12
  • And your question is? – Todd Sewell Dec 28 '16 at 09:03
  • i want to know whether it is a correct way or not to extract the geotagged data – Codrun Jan 03 '17 at 17:34
  • Okay in your post you mention that "it's not working as expected", could you elaborate on this? What happens, what did you expect instead, ... – Todd Sewell Jan 03 '17 at 20:59
  • Hi Todd, I'm receiving list of images from android and I'm saving that to particular path which i mentioned above. From those images i cound't find any geotagged meta data when i view properties. And I'm not able to get any geotagged meta data using above code. In android device those images are having geotagged meta data. So i want to know where the problem is triggering, while saving or extracting. – Codrun Jan 07 '17 at 05:54
  • Could you perhaps upload an example image file that doesn't work with this code? Make sure to use a host that doesn't strip metadata, eg. Dropbox. If the android gallery says there is geodata it should be fine really. – Todd Sewell Jan 07 '17 at 07:38
  • Thank you Todd i will check that. – Codrun Jan 11 '17 at 04:14

0 Answers0