How to get latitude and longitude information from an image

I want to get information about latitude and longitude. I googling very much to get any idea on how to get this information. I'm still trying ... If I find something related to this, I will update soon ...

If anyone has an idea about this ... then please guide me .. or provide any solution if possible ..

+6
source share
2 answers

After a lot of searching, I found a very simple solution for this question .... So I posted it here to help my friends who have problems, like me, to get the Geo location from the image ....

Bundle bundle = getIntent().getExtras(); if(null != bundle) { String filepath = bundle.getString(FILE_PATH_KEY); try { ExifInterface exif = new ExifInterface(filepath); StringBuilder builder = new StringBuilder(); builder.append("Date & Time: " + getExifTag(exif,ExifInterface.TAG_DATETIME) + "\n\n"); builder.append("Flash: " + getExifTag(exif,ExifInterface.TAG_FLASH) + "\n"); builder.append("Focal Length: " + getExifTag(exif,ExifInterface.TAG_FOCAL_LENGTH) + "\n\n"); builder.append("GPS Datestamp: " + getExifTag(exif,ExifInterface.TAG_FLASH) + "\n"); builder.append("GPS Latitude: " + getExifTag(exif,ExifInterface.TAG_GPS_LATITUDE) + "\n"); builder.append("GPS Latitude Ref: " + getExifTag(exif,ExifInterface.TAG_GPS_LATITUDE_REF) + "\n"); builder.append("GPS Longitude: " + getExifTag(exif,ExifInterface.TAG_GPS_LONGITUDE) + "\n"); builder.append("GPS Longitude Ref: " + getExifTag(exif,ExifInterface.TAG_GPS_LONGITUDE_REF) + "\n"); builder.append("GPS Processing Method: " + getExifTag(exif,ExifInterface.TAG_GPS_PROCESSING_METHOD) + "\n"); builder.append("GPS Timestamp: " + getExifTag(exif,ExifInterface.TAG_GPS_TIMESTAMP) + "\n\n"); builder.append("Image Length: " + getExifTag(exif,ExifInterface.TAG_IMAGE_LENGTH) + "\n"); builder.append("Image Width: " + getExifTag(exif,ExifInterface.TAG_IMAGE_WIDTH) + "\n\n"); builder.append("Camera Make: " + getExifTag(exif,ExifInterface.TAG_MAKE) + "\n"); builder.append("Camera Model: " + getExifTag(exif,ExifInterface.TAG_MODEL) + "\n"); builder.append("Camera Orientation: " + getExifTag(exif,ExifInterface.TAG_ORIENTATION) + "\n"); builder.append("Camera White Balance: " + getExifTag(exif,ExifInterface.TAG_WHITE_BALANCE) + "\n"); builder = null; } catch (IOException e) { e.printStackTrace(); } } 

We can get all Exif tag information from the image in one line of the builder.

+16
source

You can use the ExifInterface class to read various EXIF โ€‹โ€‹metadata from JPEG:

http://developer.android.com/reference/android/media/ExifInterface.html

+5
source

Source: https://habr.com/ru/post/893393/


All Articles