我正在编写一个 Java 程序,它实际上读取图像的所有元数据(例如纬度、经度和日期时间)。以下是我正在运行的示例代码。
public static void findLatLong(File jpg){
try {
Metadata metadata = ImageMetadataReader.readMetadata(jpg);
if (metadata.containsDirectory(GpsDirectory.class)) {
GpsDirectory gpsDir =(GpsDirectory)metadata.getDirectory(GpsDirectory.class);
GpsDescriptor gpsDesc = new GpsDescriptor(gpsDir);
System.out.println("Latitude: " + gpsDesc.getGpsLatitudeDescription());
System.out.println("Longitude : " + gpsDesc.getGpsLongitudeDescription());
System.out.println("Date : " + gpsDesc.getGpsTimeStampDescription());
System.out.println("Minute : " + gpsDesc.getDegreesMinutesSecondsDescription());
}else{
// System.out.println("----- Did not find GPS Information-------------for file " + jpg.getName() );
}
} catch (ImageProcessingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
输出: - 纬度:21.0°8.0'22.99999999998693“经度:79.0°3.0”12.999999999994998“日期:14:16:30 UTC分钟:21.0°8.0'22.99999999998693”,79.0°3.0'12.99999999994998“
我想这都是学位格式。谁能指出我如何获得纬度和经度的真正价值。并获得适当的日期。