Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get Latitude and Longitude information from picture

How to get latitude and longitude information from picture store in device or SD Card?

like image 686
Mohit Kanada Avatar asked Jul 23 '11 05:07

Mohit Kanada


People also ask

Can you get location data from a photo?

To find an image's exif data, right-click the photo and select either “properties” or “information”. If the GPS coordinates appear, simply type them into Google Maps to find the location.

Can Google identify a location from a picture?

Go to Reverse Image Search and upload any image – either from your desktop or another web page. If that photograph is of some popular destination, Google will mention the possible location of that image above the search results (see screenshot).


Video Answer


1 Answers

I found very simple solution for this question....So I posted it here to help my friends who have problem like me to get Geo location from Picture.

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 the Exif tag information from picture in one builder string.

like image 127
Mohit Kanada Avatar answered Oct 29 '22 10:10

Mohit Kanada