안드로이드 개발 질문/답변
(글 수 40,700)
지금 JPG EXIF헤더에 GPS정보와 방위각 태그를 넣고자하는데요..
ExifInterface mExif=new ExifInterface(SDCARD_PATH+"/"+filename+".jpg");
mExif.setAttribute(ExifInterface.TAG_GPS_LATITUDE,Double.toString(loc.getLatitude()));
mExif.setAttribute(ExifInterface.TAG_GPS_LONGITUDE, Double.toString(loc.getLongitude));
mExif.saveAttributes();
이렇게 소스를작성하였구 물론 변수 다 초기화도 시켜줬구요 ㅠ
그후에 getAttribute하면 저장된 위치값이 잘 출력됩니다..
그러나 컴퓨터에 설치되어있는 Exif뷰어같은 프로그램으로 정보를보면
[GPS]
GPS Latitude = 531°10'52.3776"
GPS Longitude = 531°10'52.3776"
이렇게 이상한겂으로 출력되네요 ㅠㅠ 방위각도 마찬가지로 500대로 출력되구요;
헤더파일에 저장할때 무슨 암호화를해서 저장해야하는지.. 도분초로 변환한후에 저장을해야하는지;;
안드로이드안에서만 쓰일거면 상관없는데 다른어플에도 쓰일 거라 너무 걱정됩니다..
Exif 메타데이터 writing에대해 아시면 알려주세요^^
ExifInterface mExif=new ExifInterface(SDCARD_PATH+"/"+filename+".jpg");
mExif.setAttribute(ExifInterface.TAG_GPS_LATITUDE,Double.toString(loc.getLatitude()));
mExif.setAttribute(ExifInterface.TAG_GPS_LONGITUDE, Double.toString(loc.getLongitude));
mExif.saveAttributes();
이렇게 소스를작성하였구 물론 변수 다 초기화도 시켜줬구요 ㅠ
그후에 getAttribute하면 저장된 위치값이 잘 출력됩니다..
그러나 컴퓨터에 설치되어있는 Exif뷰어같은 프로그램으로 정보를보면
[GPS]
GPS Latitude = 531°10'52.3776"
GPS Longitude = 531°10'52.3776"
이렇게 이상한겂으로 출력되네요 ㅠㅠ 방위각도 마찬가지로 500대로 출력되구요;
헤더파일에 저장할때 무슨 암호화를해서 저장해야하는지.. 도분초로 변환한후에 저장을해야하는지;;
안드로이드안에서만 쓰일거면 상관없는데 다른어플에도 쓰일 거라 너무 걱정됩니다..
Exif 메타데이터 writing에대해 아시면 알려주세요^^
혹시나 해결 못하셨을 까봐 뎃글 남깁니다. 저도 그거 때문에 고생을 많이 해서요...
Location class에 보면 double 값을 string으로 바꿔주는 convert라는 static method가 있는데요
그걸 좀 변경 하셔서 아래와 같은 포멧으로 출력되게 한다음 setAttribute에 인자로 넣어 주시면 됩니다.
"degree/1,minutes/1,seconds/1000"
위 내용중에 degree, minutes, seconds 항목은 double로 부터 구한 값이 들어 가면 되구요, 1,1,1000이라는
숫자는 앞에 있는 값들을 나누는 값입니다. 즉 seconds값은 XXX.XXXXXX 의 형태가 되겠지요.
아래 변환 함수 참고 하세요.
public static String latlocConvert(double coordinate) {
if (coordinate < -180.0 || coordinate > 180.0 ||
Double.isNaN(coordinate)) {
throw new IllegalArgumentException("coordinate=" + coordinate);
}
StringBuilder sb = new StringBuilder();
// Handle negative values
if (coordinate < 0) {
sb.append('-');
coordinate = -coordinate;
}
int degrees = (int) Math.floor(coordinate);
sb.append(degrees);
sb.append("/1,");
coordinate -= degrees;
coordinate *= 60.0;
int minutes = (int) Math.floor(coordinate);
sb.append(minutes);
sb.append("/1,");
coordinate -= minutes;
coordinate *= 60.0;
sb.append(coordinate);
sb.append("/1000");
return sb.toString();
}
그럼 즐프 하세요~