gpt4 book ai didi

android - 来自地理标记照片的 GPS 经度和纬度

转载 作者:塔克拉玛干 更新时间:2023-11-02 23:19:46 25 4
gpt4 key购买 nike

我在手机摄像头中启用了地理标记。它保存纬度和经度信息(我检查过)。我试着这样读

import static android.provider.MediaStore.Images.ImageColumns.*;    

Uri queryPhotoUri = ...; //uri of photo
String[] photoProjection = {LATITUDE,LONGITUDE,ORIENTATION,DESCRIPTION};

Cursor photoData = getContext().getContentResolver().query(
queryPhotoUri, photoProjection, null, null, null);

int latIdx = photoData.getColumnIndex(LATITUDE);
int lngIdx = photoData.getColumnIndex(LONGITUDE);
int oriIdx = photoData.getColumnIndex(ORIENTATION);
int txtIdx = photoData.getColumnIndex(DESCRIPTION);

boolean latExists = !photoData.isNull(latIdx);
boolean lngExists = !photoData.isNull(lngIdx);
boolean oriExists = !photoData.isNull(oriIdx);
boolean txtExists = !photoData.isNull(txtIdx);

oriExists 的计算结果为 TRUE,其余为 FALSE。为什么? Image Content Provider 是将纬度和经度作为 exif 属性写入照片文件,还是将它们存储在其他地方?

此外,我正在尝试将照片的描述写入 DESCRIPTION 列,但未保存。描述存储在哪里?

编辑:这越来越陌生了。我检查了框架源,MediaProvider 类从照片中读取 exif 标签并将它们存储在数据库中。但是,出于某种原因,纬度和经度字段未存储。

最佳答案

我建议你使用ExifInterface

关于android - 来自地理标记照片的 GPS 经度和纬度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5184104/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com