我想从图像中获取有关地理位置的信息 ,如下图所示

void cam_Completed(object sender, PhotoResult e)
{
if (e.TaskResult == TaskResult.OK)
{
Image cameraImage = new Image();
BitmapImage bImage = new BitmapImage();
bImage.SetSource(e.ChosenPhoto);
cameraImage.Source = bImage;
e.ChosenPhoto.Position = 0;
ExifReader reader = new ExifReader(e.ChosenPhoto);
double gpsLat, gpsLng;
reader.GetTagValue<double>(ExifTags.GPSLatitude,
out gpsLat))
reader.GetTagValue<double>(ExifTags.GPSLongitude,
out gpsLng))
MessageBox.Show(gpsLat.ToString() + "" + gpsLng.ToString());
}
}
Run Code Online (Sandbox Code Playgroud)
这样我们就可以检测拍摄图像的位置.请帮助找到这些属性.
我正忙着从我的JPEG中读取EXIF数据.我觉得这很容易做到.
到目前为止,我已经为我家人的在线图片库完成了以下步骤(使用C#/ ASP.Net 3.5):
我想从原始JPEG图像中提取纬度和经度,然后在插入文件名和类别ID的同一个proc中将这些值插入到我的数据库中(步骤#5).我需要这些值才能使用Google Maps API.最简单的方法是什么?
更新:
ExifLib看起来很棒,但是当我执行以下操作时:
double d;
ExifReader er = new ExifReader(sFileName);
er.GetTagValue<double>(ExifTags.GPSLatitude, out d);
Run Code Online (Sandbox Code Playgroud)
我在最后一行收到此错误:
指定演员表无效.
有什么建议?