如何在Delphi中使用CCR.EXIF从JPG EXIF读取GPS坐标? [英] How to read GPS Coordinates from JPG EXIF using CCR.EXIF in Delphi?

查看:255
本文介绍了如何在Delphi中使用CCR.EXIF从JPG EXIF读取GPS坐标?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用GPSLatitude和GPSLatitude属性Assign方法设置GPS坐标非常容易,但是阅读坐标却让我很头疼。我试图访问TGPSLongitude类,但是没有任何属性或方法可以使我呈现真实的/浮点的,甚至不能显示DMS的坐标。

It's quite easy setting the GPS coordinates using the GPSLatitude and GPSLatitude properties Assign method, but reading the coords has me stumped. I've trying to access the TGPSLongitude class, but none of the properties or methods would render me a real / float or even DMS of the coordinates.

示例图像:< a href = http://www.cde.co.za/share/IMG_5889.JPG rel = nofollow> http://www.cde.co.za/share/IMG_5889.JPG

我当前未编译的代码:

imgJpg: TJpegImageEx;
GPS_D: Real;

try
  imgJpg.LoadFromFile(FolderName+'\'+SR.Name);
  GPS_D:= imgJpg.ExifData.GPSLatitude.Degrees;
except
  GPS_D:= 0;
end;

编译器停在我尝试给GPS_D分配错误 [DCC Error] Main.pas的位置(205):E2010不兼容的类型:'Real'和'TTiffLongWordFraction'这显然是因为我无法将Degrees属性分配给实数。问题是如何从TGPSLongitude中提取度或十进制值?

The compiler stops at where I try to assign GPS_D with the error "[DCC Error] Main.pas(205): E2010 Incompatible types: 'Real' and 'TTiffLongWordFraction'" This is obviously because I can't assign the Degrees property to a real. The question is how do I extract the degrees or decimal value from TGPSLongitude ?

推荐答案

将GPS信息提取为<$的简便方法c $ c> string :

var myLat, myLong : string;
...
myLat := myJpeg.ExifData.GPSLatitude.AsString ; 
myLong := myJpeg.ExifData.GPSLongitude.AsString ;

这篇关于如何在Delphi中使用CCR.EXIF从JPG EXIF读取GPS坐标?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆